class Datapipes::Pipe
Pipe
is not only data pipeline but handling asynchronous.
You can make your own pipe with database or something, but becareful this object used in multi thread.
If you make your own, you can override initialize, because this is not used in internal.
Then supply pour_in and pour_out. pour_out must occur thread blocking when it is empty.
Public Class Methods
new()
click to toggle source
You can override and don’t need to call super in sub class.
# File lib/datapipes/pipe.rb, line 14 def initialize @queue ||= Queue.new end
Public Instance Methods
pour_in(data)
click to toggle source
Emit data to pipe.
# File lib/datapipes/pipe.rb, line 19 def pour_in(data) @queue.enq data end
pour_out()
click to toggle source
pour_out must cause thread blocking when it is empty.
# File lib/datapipes/pipe.rb, line 24 def pour_out @queue.deq end