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.
165 166 167 |
# File 'lib/rash/pipeline.rb', line 165 def initialize @reader, @writer = IO.pipe end |
Instance Attribute Details
#pid ⇒ Object (readonly)
Returns the value of attribute pid.
163 164 165 |
# File 'lib/rash/pipeline.rb', line 163 def pid @pid end |
#reader ⇒ Object (readonly)
Returns the value of attribute reader.
163 164 165 |
# File 'lib/rash/pipeline.rb', line 163 def reader @reader end |
#writer ⇒ Object (readonly)
Returns the value of attribute writer.
163 164 165 |
# File 'lib/rash/pipeline.rb', line 163 def writer @writer end |
Instance Method Details
#close ⇒ Object
174 175 176 177 |
# File 'lib/rash/pipeline.rb', line 174 def close @writer.close @reader.close end |
#link_process(pid) ⇒ Object
169 170 171 172 |
# File 'lib/rash/pipeline.rb', line 169 def link_process(pid) @pid ||= pid self end |
#terminate ⇒ Object
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_s ⇒ Object
185 186 187 |
# File 'lib/rash/pipeline.rb', line 185 def to_s @pid end |