User Guide
Ruby Component
As you can see, the error message is displayed in red to differentiate it from evaluated output.
Note that the error messages come directly from the Ruby interpreter. They can sometimes seem unrelated to the error. However, the Ruby
Component evaluates your code while you are typing so if an error does pop up you'll know exactly what change caused it.
One final thing worth mentioning is the output pane only shows the value of the very last evaluated expression. Take the examples below:
In the component on the left the first expression is evaluated, followed by the second expression. The second one is the last and so this gets
sent to the output pane.
In the component on the right the same thing happens. However, in order to show that the first expression does indeed get evaluated we've
assigned its result to a variable (x) and then used this in the second expression.
We now know enough about the Output Pane to proceed to the more exciting stuff.
The RubyEdit Class
Each Ruby component is represented by an instance of the RubyEdit class. This is a class we have defined in FlowBotics Studio to
represent the Ruby component.
We have defined methods and instance variables that allow you to communicate with the component. These provide the interface between
your Ruby code and FlowBotics Studio.
Typing self into the Ruby component will return the instance of the RubyEdit class that represents that component. In the above example
you can see the instance representation in the output pane.You can also use the instance variable @this instead of self.
All code you type in a Ruby component is executed within the context of the RubyEdit object that represents it.
103 of 212