Class: Low::Events::EventTree
- Inherits:
-
Object
- Object
- Low::Events::EventTree
- Includes:
- Observers
- Defined in:
- lib/pool/event_tree.rb
Instance Attribute Summary collapse
-
#current_event ⇒ Object
Returns the value of attribute current_event.
-
#request_id ⇒ Object
readonly
Returns the value of attribute request_id.
-
#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(request_id: nil) ⇒ EventTree
constructor
A new instance of EventTree.
Constructor Details
#initialize(request_id: nil) ⇒ EventTree
Returns a new instance of EventTree.
14 15 16 17 18 19 |
# File 'lib/pool/event_tree.rb', line 14 def initialize(request_id: nil) @request_id = request_id @root_event = nil @current_event = nil @sequence = [] end |
Instance Attribute Details
#current_event ⇒ Object
Returns the value of attribute current_event.
12 13 14 |
# File 'lib/pool/event_tree.rb', line 12 def current_event @current_event end |
#request_id ⇒ Object (readonly)
Returns the value of attribute request_id.
11 12 13 |
# File 'lib/pool/event_tree.rb', line 11 def request_id @request_id end |
#root_event ⇒ Object (readonly)
Returns the value of attribute root_event.
11 12 13 |
# File 'lib/pool/event_tree.rb', line 11 def root_event @root_event end |
#sequence ⇒ Object (readonly)
Returns the value of attribute sequence.
11 12 13 |
# File 'lib/pool/event_tree.rb', line 11 def sequence @sequence end |
Instance Method Details
#branch(event:) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/pool/event_tree.rb', line 21 def branch(event:) @sequence << event if @root_event.nil? @root_event = event @current_event = event else @current_event.children << event end trigger action: :branch, event: BranchEvent.new(event_tree: self, event:) end |