Class: PerfectSched::ScheduleCollection
- Inherits:
-
Object
- Object
- PerfectSched::ScheduleCollection
- Includes:
- Model
- Defined in:
- lib/perfectsched/schedule_collection.rb
Instance Attribute Summary
Attributes included from Model
Instance Method Summary collapse
-
#[](key) ⇒ Object
> Schedule.
-
#add(key, type, options = {}) ⇒ Object
:data => Hash :cron :timezone.
- #close ⇒ Object
-
#initialize(client) ⇒ ScheduleCollection
constructor
A new instance of ScheduleCollection.
- #list(options = {}, &block) ⇒ Object
- #poll(options = {}) ⇒ Object
- #poll_multi(options = {}) ⇒ Object
Methods included from Model
Constructor Details
#initialize(client) ⇒ ScheduleCollection
Returns a new instance of ScheduleCollection.
24 25 26 |
# File 'lib/perfectsched/schedule_collection.rb', line 24 def initialize(client) super(client) end |
Instance Method Details
#[](key) ⇒ Object
> Schedule
29 30 31 |
# File 'lib/perfectsched/schedule_collection.rb', line 29 def [](key) Schedule.new(@client, key) end |
#add(key, type, options = {}) ⇒ Object
:data => Hash :cron :timezone
52 53 54 |
# File 'lib/perfectsched/schedule_collection.rb', line 52 def add(key, type, ={}) @client.add(key, type, ) end |
#close ⇒ Object
56 57 58 |
# File 'lib/perfectsched/schedule_collection.rb', line 56 def close client.close end |
#list(options = {}, &block) ⇒ Object
33 34 35 |
# File 'lib/perfectsched/schedule_collection.rb', line 33 def list(={}, &block) @client.list(, &block) end |
#poll(options = {}) ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/perfectsched/schedule_collection.rb', line 37 def poll(={}) = .merge({:max_acquire=>1}) if acquired = poll_multi() return acquired[0] end return nil end |
#poll_multi(options = {}) ⇒ Object
45 46 47 |
# File 'lib/perfectsched/schedule_collection.rb', line 45 def poll_multi(={}) @client.acquire() end |