Class: TestBench::Telemetry::Sink::File
- Inherits:
-
Object
- Object
- TestBench::Telemetry::Sink::File
- Includes:
- TestBench::Telemetry::Sink
- Defined in:
- lib/test_bench/telemetry/sink/file.rb
Constant Summary
Constants included from TestBench::Telemetry::Sink
Instance Attribute Summary collapse
-
#io ⇒ Object
readonly
Returns the value of attribute io.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(io) ⇒ File
constructor
A new instance of File.
- #receive(event_data) ⇒ Object
Constructor Details
#initialize(io) ⇒ File
Returns a new instance of File.
9 10 11 |
# File 'lib/test_bench/telemetry/sink/file.rb', line 9 def initialize(io) @io = io end |
Instance Attribute Details
#io ⇒ Object (readonly)
Returns the value of attribute io.
7 8 9 |
# File 'lib/test_bench/telemetry/sink/file.rb', line 7 def io @io end |
Class Method Details
.open(path, &block) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/test_bench/telemetry/sink/file.rb', line 13 def self.open(path, &block) ::File.open(path, 'w') do |io| instance = new(io) block.(instance, io) return instance end end |
Instance Method Details
#receive(event_data) ⇒ Object
23 24 25 26 27 |
# File 'lib/test_bench/telemetry/sink/file.rb', line 23 def receive(event_data) text = event_data.dump io.write(text) end |