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.



165
166
167
# File 'lib/rash/pipeline.rb', line 165

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

Instance Attribute Details

#pidObject (readonly)

Returns the value of attribute pid.



163
164
165
# File 'lib/rash/pipeline.rb', line 163

def pid
  @pid
end

#readerObject (readonly)

Returns the value of attribute reader.



163
164
165
# File 'lib/rash/pipeline.rb', line 163

def reader
  @reader
end

#writerObject (readonly)

Returns the value of attribute writer.



163
164
165
# File 'lib/rash/pipeline.rb', line 163

def writer
  @writer
end

Instance Method Details

#closeObject



174
175
176
177
# File 'lib/rash/pipeline.rb', line 174

def close
  @writer.close
  @reader.close
end


169
170
171
172
# File 'lib/rash/pipeline.rb', line 169

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

#terminateObject



179
180
181
182
183
# File 'lib/rash/pipeline.rb', line 179

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

#to_sObject



185
186
187
# File 'lib/rash/pipeline.rb', line 185

def to_s
  @pid
end