Class: Kitchen::Logger::LineBuffer
- Inherits:
-
Object
- Object
- Kitchen::Logger::LineBuffer
- Defined in:
- lib/kitchen/logger.rb
Overview
Buffers streamed output until a complete line is available for logging.
Instance Method Summary collapse
-
#<<(msg) ⇒ void
private
Appends a chunk of stream output to the buffer, emitting each complete newline-terminated line to the line handler.
-
#initialize(&line_handler) ⇒ LineBuffer
constructor
A new instance of LineBuffer.
Constructor Details
#initialize(&line_handler) ⇒ LineBuffer
Returns a new instance of LineBuffer.
486 487 488 489 |
# File 'lib/kitchen/logger.rb', line 486 def initialize(&line_handler) @buffer = +"" @line_handler = line_handler end |
Instance Method Details
#<<(msg) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Appends a chunk of stream output to the buffer, emitting each complete newline-terminated line to the line handler.
498 499 500 501 |
# File 'lib/kitchen/logger.rb', line 498 def <<(msg) @buffer += msg flush_lines end |