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
Instance Attribute Summary collapse
-
#io ⇒ Object
readonly
Returns the value of attribute io.
Class Method Summary collapse
Instance Method Summary collapse
- #call(event) ⇒ Object
-
#initialize(io) ⇒ File
constructor
A new instance of File.
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
#call(event) ⇒ Object
23 24 25 26 27 |
# File 'lib/test_bench/telemetry/sink/file.rb', line 23 def call(event) data = event.dump io.write(data) end |