Class: Docket::RoundRobin
- Inherits:
-
Object
- Object
- Docket::RoundRobin
- Defined in:
- lib/docket/round_robin.rb
Instance Attribute Summary collapse
-
#storage ⇒ Object
Returns the value of attribute storage.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ RoundRobin
constructor
A new instance of RoundRobin.
- #perform(identifier, action) ⇒ Object
- #reset! ⇒ Object
- #set(identifier, robins, options = {}) ⇒ Object
- #unset(identifier) ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ RoundRobin
Returns a new instance of RoundRobin.
6 7 8 |
# File 'lib/docket/round_robin.rb', line 6 def initialize args={} @storage = args[:storage] || Docket.configuration.storage || Docket::Storage::Daybreak.new('/tmp/docket.rb') end |
Instance Attribute Details
#storage ⇒ Object
Returns the value of attribute storage.
4 5 6 |
# File 'lib/docket/round_robin.rb', line 4 def storage @storage end |
Instance Method Details
#perform(identifier, action) ⇒ Object
14 15 16 17 18 |
# File 'lib/docket/round_robin.rb', line 14 def perform identifier, action robin = next_robin identifier action.call(robin) robin end |
#reset! ⇒ Object
25 26 27 |
# File 'lib/docket/round_robin.rb', line 25 def reset! storage.clear! end |
#set(identifier, robins, options = {}) ⇒ Object
10 11 12 |
# File 'lib/docket/round_robin.rb', line 10 def set identifier, robins, ={} save identifier, robins, end |
#unset(identifier) ⇒ Object
20 21 22 23 |
# File 'lib/docket/round_robin.rb', line 20 def unset identifier unset_key identifier unset_from_groups identifier end |