Class: Kubernetes::Stream
- Inherits:
-
Object
- Object
- Kubernetes::Stream
- Defined in:
- lib/kubernetes/stream.rb
Instance Method Summary collapse
- #each(*args) ⇒ Object
-
#initialize(connection) ⇒ Stream
constructor
A new instance of Stream.
Constructor Details
#initialize(connection) ⇒ Stream
Returns a new instance of Stream.
3 4 5 |
# File 'lib/kubernetes/stream.rb', line 3 def initialize(connection) @connection = connection end |
Instance Method Details
#each(*args) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/kubernetes/stream.rb', line 7 def each(*args) buffer = "" @connection.stream(*args) do |chunk| buffer << chunk while line = buffer.slice!(/\A.+\n/) yield line end end end |