Class: Low::Events::EventPool
- Inherits:
-
Object
- Object
- Low::Events::EventPool
- Includes:
- Observers
- Defined in:
- lib/pool/event_pool.rb
Constant Summary collapse
- BUFFER_SIZE =
100
Instance Method Summary collapse
- #current_event_tree(event:) ⇒ Object
- #event_trees ⇒ Object
-
#initialize ⇒ EventPool
constructor
A new instance of EventPool.
Constructor Details
#initialize ⇒ EventPool
Returns a new instance of EventPool.
16 17 18 19 |
# File 'lib/pool/event_pool.rb', line 16 def initialize @pool = Support::PoolHash.new(BUFFER_SIZE) @request_counts = Support::PoolHash.new(BUFFER_SIZE) end |
Instance Method Details
#current_event_tree(event:) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/pool/event_pool.rb', line 21 def current_event_tree(event:) request_id = request_id(event:) return @pool[request_id] if @pool[request_id] event_tree = @pool.add(request_id, EventTree.new(request_id:)) trigger action: :new_event_tree, event: event_tree event_tree end |
#event_trees ⇒ Object
32 33 34 |
# File 'lib/pool/event_pool.rb', line 32 def event_trees @pool end |