Class: Environment::Pipeline
- Inherits:
-
Object
- Object
- Environment::Pipeline
- Defined in:
- lib/rash/pipeline.rb
Instance Attribute Summary collapse
-
#pid ⇒ Object
readonly
Returns the value of attribute pid.
-
#reader ⇒ Object
readonly
Returns the value of attribute reader.
-
#writer ⇒ Object
readonly
Returns the value of attribute writer.
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize ⇒ Pipeline
constructor
A new instance of Pipeline.
- #link_process(pid) ⇒ Object
- #terminate ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ Pipeline
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
#pid ⇒ Object (readonly)
Returns the value of attribute pid.
77 78 79 |
# File 'lib/rash/pipeline.rb', line 77 def pid @pid end |
#reader ⇒ Object (readonly)
Returns the value of attribute reader.
77 78 79 |
# File 'lib/rash/pipeline.rb', line 77 def reader @reader end |
#writer ⇒ Object (readonly)
Returns the value of attribute writer.
77 78 79 |
# File 'lib/rash/pipeline.rb', line 77 def writer @writer end |
Instance Method Details
#close ⇒ Object
88 89 90 91 |
# File 'lib/rash/pipeline.rb', line 88 def close @writer.close @reader.close end |
#link_process(pid) ⇒ Object
83 84 85 86 |
# File 'lib/rash/pipeline.rb', line 83 def link_process(pid) @pid ||= pid self end |
#terminate ⇒ Object
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_s ⇒ Object
99 100 101 |
# File 'lib/rash/pipeline.rb', line 99 def to_s @pid end |