| Class EventFramework::Event |
|
|
Event represents a single event that has occurred at a specific point in time. An EventGenerator typically creates events which are then placed on the event queue at regular intervals by an EventDispatcher. Alternatively, events can be explicitly placed on the event queue using the dispatcher. In both cases, events are then pulled off the queue and processed by an EventProcessor. After an event has been processed, it should not be injected back into the system (do not reuse events).
| Methods |
| Attributes |
| data | [R] | Arbitrary data associated with the event. This is strictly informational and is not used directly. It is expected that users’ event handlers will utilize this data when processing the event. |
| handler | [R] | The EventHandler that should be used to process this event. Any object may used as an event handler so long as it responds to the handle_event method. |
| originator | [R] | The originator of the event. This is a strictly informational piece of data that should be used to identify the object that originated the event. This value can be a reference to any object. The associated handler may use this value during the processing of the event. |
| time | [R] | The time the event was created (not the time it was processed), stored as an instance of Time. |
| Public Class methods |
| new(originator, data, handler) |
Creates a new event with the specified arguments:
| Public Instance methods |
| process() |
Processes the event by invoking the EventHandler associated with this event. Events are typically processed by an EventProcessor in a separate thread of execution to avoid interfering with the dispatching of events.
| to_s() |
Returns a string representation of the event which includes the time, originator, as well as any data associated with the event.