Class: RSpecTelemetry::Trace::Viewer::TailSource
- Inherits:
-
Object
- Object
- RSpecTelemetry::Trace::Viewer::TailSource
- Defined in:
- lib/rspec_telemetry/trace/viewer/source.rb
Instance Method Summary collapse
- #drain ⇒ Object
-
#initialize(path) ⇒ TailSource
constructor
A new instance of TailSource.
Constructor Details
#initialize(path) ⇒ TailSource
Returns a new instance of TailSource.
7 8 9 10 11 |
# File 'lib/rspec_telemetry/trace/viewer/source.rb', line 7 def initialize(path) @path = path @offset = 0 @partial = +"" end |
Instance Method Details
#drain ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rspec_telemetry/trace/viewer/source.rb', line 13 def drain return [] unless File.file?(@path) reset_if_shrunk chunk = read_new_bytes return [] if chunk.empty? @partial << chunk split_complete_lines end |