Class: Roby::Coordination::Models::Event
- Defined in:
- lib/roby/coordination/models/event.rb
Overview
A representation of an event on the execution context’s task
Instance Attribute Summary collapse
-
#symbol ⇒ Symbol
readonly
The event’s symbol.
-
#task ⇒ Coordination::Models::Task
readonly
The task this event is defined on.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#forward_to(root_event) ⇒ Object
When running in this event’s state, forward this event to the given root task event.
-
#initialize(task, symbol) ⇒ Event
constructor
A new instance of Event.
- #new(execution_context) ⇒ Coordination::Base::Event
- #to_s ⇒ Object
Constructor Details
#initialize(task, symbol) ⇒ Event
Returns a new instance of Event.
11 12 13 |
# File 'lib/roby/coordination/models/event.rb', line 11 def initialize(task, symbol) @task, @symbol = task, symbol.to_sym end |
Instance Attribute Details
#symbol ⇒ Symbol (readonly)
Returns the event’s symbol.
9 10 11 |
# File 'lib/roby/coordination/models/event.rb', line 9 def symbol @symbol end |
#task ⇒ Coordination::Models::Task (readonly)
Returns The task this event is defined on.
7 8 9 |
# File 'lib/roby/coordination/models/event.rb', line 7 def task @task end |
Instance Method Details
#==(other) ⇒ Object
20 21 22 23 24 |
# File 'lib/roby/coordination/models/event.rb', line 20 def ==(other) other.kind_of?(self.class) && other.symbol == symbol && other.task == task end |
#forward_to(root_event) ⇒ Object
When running in this event’s state, forward this event to the given root task event
28 29 30 31 32 33 34 |
# File 'lib/roby/coordination/models/event.rb', line 28 def forward_to(root_event) if !root_event.task.respond_to?(:coordination_model) raise NotRootEvent, "can only forward to a root event" end root_event.task.coordination_model. forward task, self, root_event end |
#new(execution_context) ⇒ Coordination::Base::Event
16 17 18 |
# File 'lib/roby/coordination/models/event.rb', line 16 def new(execution_context) Coordination::Event.new(execution_context, self) end |
#to_s ⇒ Object
36 |
# File 'lib/roby/coordination/models/event.rb', line 36 def to_s; "#{task}.#{symbol}_event" end |