User Guide
Ruby Component
Scheduling Events
You may recall from the Data Types and Signal Flow section that, unlike triggered data which is sent immediately, event data can be
scheduled to be sent at some time in the future.
To do this a schematic has a clock. The clock is an elapsed time, in real world seconds, which begins when the schematic is loaded or
created. The clock does not represent a time of day, it is simply a counter which continually increases.
Scheduling an Event
To schedule an event you need to provide a time stamp when you send data to an output. This needs to be supplied as a third input
parameter when you use the output method.
The time stamp will almost always be an offset from the current time. You can get the time in two different ways depending on where you
make the call from.
From any location you can use the time method. If you're in the event method then if you define it with input reference, value and time inputs
then you will have the time passed to you via the time input parameter.
The event will be sent to the events queue and will only be sent out through the designated output when the clock time for the event time
stamp is reached.
The example below shows how to schedule an event from inside an event method using the time input parameter.
Sending to an Input
You can send events back to the same Ruby component by sending them to an input. This is useful if you want to create a repeating event
or perform a recursive operation.
To do this use the input method. This works in exactly the same way as the output method but of course the connector reference refers to
the input you want to send the event to instead.
109 of 212