Class: Ibex::Runtime::EventJSONLTracer
- Inherits:
-
Object
- Object
- Ibex::Runtime::EventJSONLTracer
- Defined in:
- lib/json5/generated_parser.rb
Overview
Emits schema-v1 immutable runtime events as JSON Lines.
Instance Attribute Summary collapse
- #parser ⇒ Object readonly
- #subscription ⇒ Object readonly
Class Method Summary collapse
Instance Method Summary collapse
- #detach ⇒ Object
-
#initialize(parser, output) ⇒ EventJSONLTracer
constructor
A new instance of EventJSONLTracer.
Constructor Details
#initialize(parser, output) ⇒ EventJSONLTracer
Returns a new instance of EventJSONLTracer.
9456 9457 9458 9459 9460 |
# File 'lib/json5/generated_parser.rb', line 9456 def initialize(parser, output) @parser = parser @output = output @subscription = parser.observe { |event| output.puts(JSON.generate(event.to_h)) } end |
Instance Attribute Details
#parser ⇒ Object (readonly)
9452 9453 9454 |
# File 'lib/json5/generated_parser.rb', line 9452 def parser @parser end |
#subscription ⇒ Object (readonly)
9453 9454 9455 |
# File 'lib/json5/generated_parser.rb', line 9453 def subscription @subscription end |
Class Method Details
.attach(parser, io:) ⇒ Object
9468 9469 9470 |
# File 'lib/json5/generated_parser.rb', line 9468 def self.attach(parser, io:) new(parser, io) end |
Instance Method Details
#detach ⇒ Object
9463 9464 9465 |
# File 'lib/json5/generated_parser.rb', line 9463 def detach @parser.unobserve(@subscription) end |