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.
13 14 15 |
# File 'lib/roby/coordination/models/event.rb', line 13 def initialize(task, symbol) @task, @symbol = task, symbol.to_sym end |
Instance Attribute Details
#symbol ⇒ Symbol (readonly)
Returns the event’s symbol.
11 12 13 |
# File 'lib/roby/coordination/models/event.rb', line 11 def symbol @symbol end |
#task ⇒ Coordination::Models::Task (readonly)
Returns The task this event is defined on.
9 10 11 |
# File 'lib/roby/coordination/models/event.rb', line 9 def task @task end |
Instance Method Details
#==(other) ⇒ Object
22 23 24 25 26 |
# File 'lib/roby/coordination/models/event.rb', line 22 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
30 31 32 33 34 35 36 37 38 |
# File 'lib/roby/coordination/models/event.rb', line 30 def forward_to(root_event) unless root_event.task.respond_to?(:coordination_model) raise NotRootEvent, "can only forward to a root event" end root_event.task.coordination_model.parse_names root_event.task.coordination_model .forward task, self, root_event end |
#new(execution_context) ⇒ Coordination::Base::Event
18 19 20 |
# File 'lib/roby/coordination/models/event.rb', line 18 def new(execution_context) Coordination::Event.new(execution_context, self) end |
#to_s ⇒ Object
40 41 42 |
# File 'lib/roby/coordination/models/event.rb', line 40 def to_s "#{task}.#{symbol}_event" end |