Class: DriqDownstream
Constant Summary
Constants inherited from Driq
Instance Method Summary collapse
- #download ⇒ Object
-
#initialize(upper, size = 100) ⇒ DriqDownstream
constructor
A new instance of DriqDownstream.
- #write(value) ⇒ Object
Methods inherited from Driq
#close, #last, #last_key, #read, #readpartial
Constructor Details
#initialize(upper, size = 100) ⇒ DriqDownstream
Returns a new instance of DriqDownstream.
78 79 80 81 82 |
# File 'lib/driq.rb', line 78 def initialize(upper, size=100) super(size) @upper = upper Thread.new { download } end |
Instance Method Details
#download ⇒ Object
88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/driq.rb', line 88 def download while true ary = @upper.readpartial(@last, @ceil) synchronize do @list += ary @list = @list.last(@floor) if @list.size > @ceil @last = ary.last[0] @event.broadcast end end end |
#write(value) ⇒ Object
84 85 86 |
# File 'lib/driq.rb', line 84 def write(value) @upper.write(value) end |