Class: RIO::Cmd::From
Instance Attribute Summary collapse
-
#pipe ⇒ Object
readonly
Returns the value of attribute pipe.
Attributes inherited from FibPipe
Instance Method Summary collapse
- #_create_output_fiber ⇒ Object
- #_fiber_init(trail) ⇒ Object
-
#initialize(io) ⇒ From
constructor
A new instance of From.
- #process_loop ⇒ Object
Methods inherited from FibPipe
#dest_report_data_done, #dest_report_new_data, #dest_wait_for_reader, #fiber_yield, #resume, #source_resume
Constructor Details
Instance Attribute Details
#pipe ⇒ Object (readonly)
Returns the value of attribute pipe.
168 169 170 |
# File 'lib/rio/fibpipe.rb', line 168 def pipe @pipe end |
Instance Method Details
#_create_output_fiber ⇒ Object
179 180 181 182 183 184 185 186 |
# File 'lib/rio/fibpipe.rb', line 179 def _create_output_fiber fibname = /[^:]+$/.match(self.class.to_s)[0] NamedFiber.new(fibname) do |trail| _fiber_init(trail) process_loop dest_wait_for_reader end end |
#_fiber_init(trail) ⇒ Object
175 176 177 178 |
# File 'lib/rio/fibpipe.rb', line 175 def _fiber_init(trail) super source_resume(trail) if source end |
#process_loop ⇒ Object
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
# File 'lib/rio/fibpipe.rb', line 187 def process_loop loop do begin rec = get() data.out.write(rec) data.out.flush dest_report_new_data rescue Errno::EWOULDBLOCK source_resume(true) or source_wait rescue Errno::EINTR break rescue EOFError,StopIteration data.out.close_write source_resume(nil) if source break end end end |