Class: Ibex::Runtime::EventJSONLTracer
- Inherits:
-
Object
- Object
- Ibex::Runtime::EventJSONLTracer
- Defined in:
- lib/ibex/runtime/event_jsonl_tracer.rb,
sig/ibex/runtime/event_jsonl_tracer.rbs
Overview
Emits schema-v1 immutable runtime events as JSON Lines.
Defined Under Namespace
Modules: _EventTraceOutput
Instance Attribute Summary collapse
- #parser ⇒ Parser readonly
- #subscription ⇒ Observation::Subscription readonly
Class Method Summary collapse
Instance Method Summary collapse
- #detach ⇒ Boolean
-
#initialize(parser, output) ⇒ EventJSONLTracer
constructor
A new instance of EventJSONLTracer.
Constructor Details
#initialize(parser, output) ⇒ EventJSONLTracer
Returns a new instance of EventJSONLTracer.
20 21 22 23 24 |
# File 'lib/ibex/runtime/event_jsonl_tracer.rb', line 20 def initialize(parser, output) @parser = parser @output = output @subscription = parser.observe { |event| output.puts(JSON.generate(event.to_h)) } end |
Instance Attribute Details
#parser ⇒ Parser (readonly)
16 17 18 |
# File 'lib/ibex/runtime/event_jsonl_tracer.rb', line 16 def parser @parser end |
#subscription ⇒ Observation::Subscription (readonly)
17 18 19 |
# File 'lib/ibex/runtime/event_jsonl_tracer.rb', line 17 def subscription @subscription end |
Class Method Details
.attach(parser, io:) ⇒ void
This method returns an undefined value.
32 33 34 |
# File 'lib/ibex/runtime/event_jsonl_tracer.rb', line 32 def self.attach(parser, io:) new(parser, io) end |
Instance Method Details
#detach ⇒ Boolean
27 28 29 |
# File 'lib/ibex/runtime/event_jsonl_tracer.rb', line 27 def detach @parser.unobserve(@subscription) end |