Class: RefillingQueue
- Inherits:
-
Object
- Object
- RefillingQueue
- Defined in:
- lib/refilling_queue.rb,
lib/refilling_queue/version.rb
Defined Under Namespace
Classes: Locked
Constant Summary collapse
- DEFAULT_OPTIONS =
{ :lock_timeout => 60, :refresh_every => nil }
- VERSION =
'0.0.3'
Instance Method Summary collapse
-
#initialize(client, name, options = {}, &block) ⇒ RefillingQueue
constructor
A new instance of RefillingQueue.
- #pop ⇒ Object
Constructor Details
#initialize(client, name, options = {}, &block) ⇒ RefillingQueue
Returns a new instance of RefillingQueue.
12 13 14 15 16 |
# File 'lib/refilling_queue.rb', line 12 def initialize(client, name, ={}, &block) @client, @name, @block = client, name, block @options = DEFAULT_OPTIONS.merge() raise "Invalid keys" if (.keys - DEFAULT_OPTIONS.keys).any? end |
Instance Method Details
#pop ⇒ Object
18 19 20 21 22 23 |
# File 'lib/refilling_queue.rb', line 18 def pop item = _pop return item unless item.nil? refill _pop end |