Class: SolidFlow::Signals::Buffer
- Inherits:
-
Object
- Object
- SolidFlow::Signals::Buffer
- Defined in:
- lib/solid_flow/signals.rb
Overview
In-memory signal buffer used during replay to determine if waits can proceed.
Instance Method Summary collapse
- #consume(name) ⇒ Object
-
#initialize(messages = []) ⇒ Buffer
constructor
A new instance of Buffer.
- #pending?(name) ⇒ Boolean
- #push(message) ⇒ Object
- #to_a ⇒ Object
Constructor Details
#initialize(messages = []) ⇒ Buffer
Returns a new instance of Buffer.
24 25 26 |
# File 'lib/solid_flow/signals.rb', line 24 def initialize( = []) = end |
Instance Method Details
#consume(name) ⇒ Object
32 33 34 35 36 |
# File 'lib/solid_flow/signals.rb', line 32 def consume(name) entry = .find { |m| m.name == name.to_sym && !m.consumed? } entry&.consume! entry end |
#pending?(name) ⇒ Boolean
38 39 40 |
# File 'lib/solid_flow/signals.rb', line 38 def pending?(name) .any? { |m| m.name == name.to_sym && !m.consumed? } end |
#push(message) ⇒ Object
28 29 30 |
# File 'lib/solid_flow/signals.rb', line 28 def push() << end |
#to_a ⇒ Object
42 43 44 |
# File 'lib/solid_flow/signals.rb', line 42 def to_a .map(&:dup) end |