Class: TorigoyaKit::StreamOutput

Inherits:
Object
  • Object
show all
Defined in:
lib/torigoya_kit/stream_result.rb

Constant Summary collapse

StdoutFd =
1
StderrFd =
2

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fd, buffer) ⇒ StreamOutput

Returns a new instance of StreamOutput.



18
19
20
21
22
23
# File 'lib/torigoya_kit/stream_result.rb', line 18

def initialize(fd, buffer)
  @fd = fd
  @buffer = buffer

  validate
end

Instance Attribute Details

#bufferObject (readonly)

Returns the value of attribute buffer.



24
25
26
# File 'lib/torigoya_kit/stream_result.rb', line 24

def buffer
  @buffer
end

#fdObject (readonly)

Returns the value of attribute fd.



24
25
26
# File 'lib/torigoya_kit/stream_result.rb', line 24

def fd
  @fd
end

Class Method Details

.from_hash(hash) ⇒ Object



26
27
28
# File 'lib/torigoya_kit/stream_result.rb', line 26

def self.from_hash(hash)
  return StreamOutput.new(hash["fd"], hash["buffer"])
end

Instance Method Details

#to_sObject



30
31
32
# File 'lib/torigoya_kit/stream_result.rb', line 30

def to_s
  return "#{self.class}/[#{@fd} #{@buffer}]"
end