Class: RIO::Cmd::FibPipe
Constant Summary collapse
- @@depth =
0
Instance Attribute Summary collapse
-
#fib ⇒ Object
readonly
Returns the value of attribute fib.
-
#source ⇒ Object
Returns the value of attribute source.
Instance Method Summary collapse
- #_fiber_init(trail) ⇒ Object
- #dest_report_data_done ⇒ Object
- #dest_report_new_data ⇒ Object
- #dest_wait_for_reader ⇒ Object
- #fiber_yield(*args) ⇒ Object
-
#initialize(fib) ⇒ FibPipe
constructor
A new instance of FibPipe.
- #resume(*args) ⇒ Object
- #source_resume(*args) ⇒ Object
Constructor Details
#initialize(fib) ⇒ FibPipe
Returns a new instance of FibPipe.
35 36 37 38 39 |
# File 'lib/rio/fibpipe.rb', line 35 def initialize(fib) @fib = fib @data = IOPair.new @source = nil end |
Instance Attribute Details
#fib ⇒ Object (readonly)
Returns the value of attribute fib.
33 34 35 |
# File 'lib/rio/fibpipe.rb', line 33 def fib @fib end |
#source ⇒ Object
Returns the value of attribute source.
34 35 36 |
# File 'lib/rio/fibpipe.rb', line 34 def source @source end |
Instance Method Details
#_fiber_init(trail) ⇒ Object
64 65 66 |
# File 'lib/rio/fibpipe.rb', line 64 def _fiber_init(trail) self.source = trail.shift end |
#dest_report_data_done ⇒ Object
61 62 63 |
# File 'lib/rio/fibpipe.rb', line 61 def dest_report_data_done fiber_yield nil end |
#dest_report_new_data ⇒ Object
58 59 60 |
# File 'lib/rio/fibpipe.rb', line 58 def dest_report_new_data fiber_yield true end |
#dest_wait_for_reader ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/rio/fibpipe.rb', line 51 def dest_wait_for_reader while ans = fiber_yield(nil) p " #{self.class}: Waiting #{ans.inspect}" sleep 1 #break end end |
#fiber_yield(*args) ⇒ Object
47 48 49 50 |
# File 'lib/rio/fibpipe.rb', line 47 def fiber_yield(*args) @@depth -= 1 Fiber.yield(*args) end |
#resume(*args) ⇒ Object
40 41 42 |
# File 'lib/rio/fibpipe.rb', line 40 def resume(*args) fib.resume(*args) end |
#source_resume(*args) ⇒ Object
43 44 45 46 |
# File 'lib/rio/fibpipe.rb', line 43 def source_resume(*args) @@depth += 1 source.resume(*args) end |