Class: Julewire::Core::Testing::CaptureDestination
- Inherits:
-
Object
- Object
- Julewire::Core::Testing::CaptureDestination
- Defined in:
- lib/julewire/core/testing.rb
Instance Attribute Summary collapse
- #name ⇒ Object readonly
- #records ⇒ Object readonly
Instance Method Summary collapse
- #clear ⇒ Object
- #close ⇒ Object
- #emit(record) ⇒ Object
- #flush ⇒ Object
- #health ⇒ Object
-
#initialize(name: :capture, snapshot: true) ⇒ CaptureDestination
constructor
A new instance of CaptureDestination.
Constructor Details
#initialize(name: :capture, snapshot: true) ⇒ CaptureDestination
Returns a new instance of CaptureDestination.
11 12 13 14 15 |
# File 'lib/julewire/core/testing.rb', line 11 def initialize(name: :capture, snapshot: true) @name = name @snapshot = snapshot @records = [] end |
Instance Attribute Details
#name ⇒ Object (readonly)
9 10 11 |
# File 'lib/julewire/core/testing.rb', line 9 def name @name end |
#records ⇒ Object (readonly)
9 10 11 |
# File 'lib/julewire/core/testing.rb', line 9 def records @records end |
Instance Method Details
#clear ⇒ Object
34 35 36 37 |
# File 'lib/julewire/core/testing.rb', line 34 def clear @records.clear self end |
#close ⇒ Object
26 27 28 |
# File 'lib/julewire/core/testing.rb', line 26 def close(*) self end |
#emit(record) ⇒ Object
17 18 19 20 |
# File 'lib/julewire/core/testing.rb', line 17 def emit(record) @records << (@snapshot ? record.to_h : record) nil end |
#flush ⇒ Object
22 23 24 |
# File 'lib/julewire/core/testing.rb', line 22 def flush(*) self end |
#health ⇒ Object
30 31 32 |
# File 'lib/julewire/core/testing.rb', line 30 def health { status: :ok, counts: { captured: @records.size } } end |