Class: Kubernetes::Stream

Inherits:
Object
  • Object
show all
Defined in:
lib/kubernetes/stream.rb

Instance Method Summary collapse

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