Input names in Ruby code?
Posted: Sat Nov 16, 2013 6:23 pm
User Guide wrote:It's useful to be able to name connectors, not only for readability (so it's clear what the data represents)
but also because in the case of input connectors the label can be used within your Ruby code as a
variable or as a reference to an input.
That made perfect sense when I red it the first time... but now I'm trying to learn from existing code in stock modules and I've come across something perplexing.
Inside the toggle switch module is some code that stores/changes the Boolean state of the switch and displays part of a gif strip.
One of the connectors is labeled 'setState' and it is clearly the Boolean input where the switch gets set by the preset.
So looking in the code I expect to see it as '@setState' but instead a variable '@on' seems to be there in the role.
So I wonder what happens when you change input names and I found I could change all the input names and the code will still work. So I'm wondering what the actual mechanism for defining input names is.
Can anyone clear up my confusion on this?