Class: Docker::API::Stream::JSONLines
- Inherits:
-
Object
- Object
- Docker::API::Stream::JSONLines
- Defined in:
- lib/docker/api/stream.rb
Overview
Parses the newline-delimited JSON that pull, push, build and /events stream their progress in.
Instance Method Summary collapse
- #<<(chunk) ⇒ self
-
#initialize {|object| ... } ⇒ JSONLines
constructor
A new instance of JSONLines.
Constructor Details
#initialize {|object| ... } ⇒ JSONLines
Returns a new instance of JSONLines.
86 87 88 89 90 91 |
# File 'lib/docker/api/stream.rb', line 86 def initialize(&block) raise ArgumentError, "JSONLines needs a block to yield objects to" unless block @block = block @buffer = +"" end |
Instance Method Details
#<<(chunk) ⇒ self
96 97 98 99 100 |
# File 'lib/docker/api/stream.rb', line 96 def <<(chunk) @buffer << chunk.to_s emit_lines self end |