Class: Docket::RoundRobin

Inherits:
Object
  • Object
show all
Defined in:
lib/docket/round_robin.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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::Storage.new('/tmp/docket.rb')
end

Instance Attribute Details

#storageObject

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
# File 'lib/docket/round_robin.rb', line 14

def perform identifier, action
  robin = _next_robin identifier
  action.call(robin)
end

#set(identifier, robins, options = {}) ⇒ Object



10
11
12
# File 'lib/docket/round_robin.rb', line 10

def set identifier, robins, options={}
  _set identifier, robins, options
end

#unset(identifier) ⇒ Object



19
20
21
22
# File 'lib/docket/round_robin.rb', line 19

def unset identifier
  unset_key identifier
  unset_from_groups identifier
end