User Guide

Ruby Component
Ruby Values
Earlier in this guide we talked about the Ruby Value connector type. This is used to pass data from one Ruby component to another.
It's a very simple concept but as you'll see, it's also incredibly powerful as it gives you the flexibility to define and use your own data types.
We'll start with a quick reminder of what a Ruby Value is.
The Ruby Value Type
In Ruby all data is considered to be an object. Numbers are objects, strings are objects, arrays are objects – everything is an object. Each
object is an instance of some class. For example, an integer object is an instance of the FixNum class and an array is an instance of the
Array class.
Some classes are subclasses of a parent class. FixNum for example is a subclass of the Integer class. Those superclasses can
themselves be subclasses of another class. A key aspect of Ruby is that no matter how many superclasses there are they all end up at one
common base class called Object. So all data is in fact an instance of the Object class and as such we can consider everything as having
the same common base type.
When referring to ruby data in this common way we call it a VALUE. As such, when you pass Ruby objects between Ruby components you
pass them through the Ruby Value connector.
Value – can refer to any Ruby object
Passing Ruby Values
Ruby values can be passed from one Ruby component to another. Data is transferred using the Event system we talked about earlier.
Because everything in Ruby is an object you can pass anything you like between components. This opens up many possibilities.
For example, FlowBotics Studio has Bus components which are used to pass collections of data around via one single connector. The Ruby
Value connector can act like a bus by passing a Ruby hash (a collection of data and string pairs).
The example below shows how a Bus can be created using the Ruby component.
111 of 212