Class: Low::Events::EventTree
- Inherits:
-
Object
- Object
- Low::Events::EventTree
- Defined in:
- lib/pool/event_tree.rb
Instance Attribute Summary collapse
-
#current_event ⇒ Object
Returns the value of attribute current_event.
-
#root_event ⇒ Object
readonly
Returns the value of attribute root_event.
-
#sequence ⇒ Object
readonly
Returns the value of attribute sequence.
Instance Method Summary collapse
- #branch(event:) ⇒ Object
-
#initialize ⇒ EventTree
constructor
A new instance of EventTree.
Constructor Details
#initialize ⇒ EventTree
Returns a new instance of EventTree.
9 10 11 12 13 14 |
# File 'lib/pool/event_tree.rb', line 9 def initialize @root_event = nil @current_event = nil @sequence = [] end |
Instance Attribute Details
#current_event ⇒ Object
Returns the value of attribute current_event.
7 8 9 |
# File 'lib/pool/event_tree.rb', line 7 def current_event @current_event end |
#root_event ⇒ Object (readonly)
Returns the value of attribute root_event.
6 7 8 |
# File 'lib/pool/event_tree.rb', line 6 def root_event @root_event end |
#sequence ⇒ Object (readonly)
Returns the value of attribute sequence.
6 7 8 |
# File 'lib/pool/event_tree.rb', line 6 def sequence @sequence end |
Instance Method Details
#branch(event:) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/pool/event_tree.rb', line 16 def branch(event:) @sequence << event if @root_event.nil? @root_event = event @current_event = event else @current_event.children << event end end |