Class: Environment::Pipeline

Inherits:
Object
  • Object
show all
Defined in:
lib/rash/pipeline.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePipeline

Returns a new instance of Pipeline.



79
80
81
# File 'lib/rash/pipeline.rb', line 79

def initialize
  @reader, @writer = IO.pipe
end

Instance Attribute Details

#pidObject (readonly)

Returns the value of attribute pid.



77
78
79
# File 'lib/rash/pipeline.rb', line 77

def pid
  @pid
end

#readerObject (readonly)

Returns the value of attribute reader.



77
78
79
# File 'lib/rash/pipeline.rb', line 77

def reader
  @reader
end

#writerObject (readonly)

Returns the value of attribute writer.



77
78
79
# File 'lib/rash/pipeline.rb', line 77

def writer
  @writer
end

Instance Method Details

#closeObject



88
89
90
91
# File 'lib/rash/pipeline.rb', line 88

def close
  @writer.close
  @reader.close
end


83
84
85
86
# File 'lib/rash/pipeline.rb', line 83

def link_process(pid)
  @pid ||= pid
  self
end

#terminateObject



93
94
95
96
97
# File 'lib/rash/pipeline.rb', line 93

def terminate
  self.close
  Process.kill(:PIPE, @pid)
  Process.wait(@pid)
end

#to_sObject



99
100
101
# File 'lib/rash/pipeline.rb', line 99

def to_s
  @pid
end