Module: EventMachine::Timers
- Defined in:
- lib/em-timers/cron_line.rb,
lib/em-timers/em-timers.rb
Defined Under Namespace
Class Method Summary collapse
- .cron(spec, &blk) ⇒ Object
- .do(options = {}, &blk) ⇒ Object
- .do_daily(options = {}, &blk) ⇒ Object
- .do_hourly(options = {}, &blk) ⇒ Object
- .do_monthly(options = {}, &blk) ⇒ Object
- .do_weekly(options = {}, &blk) ⇒ Object
- .find_by_name(name) ⇒ Object
- .find_by_tag(tag) ⇒ Object
- .list ⇒ Object
Class Method Details
.cron(spec, &blk) ⇒ Object
142 143 144 |
# File 'lib/em-timers/em-timers.rb', line 142 def self.cron(spec, &blk) self.do({:cron => spec}, &blk) end |
.do(options = {}, &blk) ⇒ Object
122 123 124 |
# File 'lib/em-timers/em-timers.rb', line 122 def self.do(={}, &blk) Timer.new(, blk).schedule end |
.do_daily(options = {}, &blk) ⇒ Object
130 131 132 |
# File 'lib/em-timers/em-timers.rb', line 130 def self.do_daily(={}, &blk) self.do({:every => 1.day}.merge(), &blk) end |
.do_hourly(options = {}, &blk) ⇒ Object
126 127 128 |
# File 'lib/em-timers/em-timers.rb', line 126 def self.do_hourly(={}, &blk) self.do({:every => 1.hour}.merge(), &blk) end |
.do_monthly(options = {}, &blk) ⇒ Object
138 139 140 |
# File 'lib/em-timers/em-timers.rb', line 138 def self.do_monthly(={}, &blk) self.do({:every => 1.month}.merge(), &blk) end |
.do_weekly(options = {}, &blk) ⇒ Object
134 135 136 |
# File 'lib/em-timers/em-timers.rb', line 134 def self.do_weekly(={}, &blk) self.do({:every => 1.week}.merge(), &blk) end |
.find_by_name(name) ⇒ Object
156 157 158 159 160 |
# File 'lib/em-timers/em-timers.rb', line 156 def self.find_by_name(name) Timer.list.find_all { |t| t.name == name } end |