User Guide
Ruby Component
Note that output is not a keyword, it's a method of the RubyEdit class. Usually you would invoke a method on an object. However, in the
case of the Ruby component all code is evaluated in the context of the RubyEdit instance that represents it.
You could just as easily write self.output and you'd get the same result.
For this reason methods of the RubyEdit class are shown in purple so that you can distinguish them from Ruby keywords (which themselves
show in blue) and inherited methods (which show in black).
Specifying an Output
In the previous example no output was specified and so the result is sent to the first output. If you want to specify a particular output then you
add this as the first input to the output method.
The value can be the index of an output connector (starting from zero) as shown below:
Or it can be the label of an output connector if you've specified one:
Storage of Outputs
Just as the input data was stored in a Ruby Array we do the same for the output data. The very last value sent to an output is stored in an
Array called @outs.
You can inspect the contents of this array in the same way as for the inputs array. This can be useful when debugging.
You can change the contents of the @outs array. This can be useful if you want to change a value at an output without sending an event or
trigger. The value can then be read by other components that connect to the output.
105 of 212