Module: EventMachine::Timers

Defined in:
lib/em-timers/cron_line.rb,
lib/em-timers/em-timers.rb

Defined Under Namespace

Classes: CronLine, Timer

Class Method Summary collapse

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(options={}, &blk)
  Timer.new(options, blk).schedule
end

.do_daily(options = {}, &blk) ⇒ Object



130
131
132
# File 'lib/em-timers/em-timers.rb', line 130

def self.do_daily(options={}, &blk)
  self.do({:every => 1.day}.merge(options), &blk)
end

.do_hourly(options = {}, &blk) ⇒ Object



126
127
128
# File 'lib/em-timers/em-timers.rb', line 126

def self.do_hourly(options={}, &blk)
  self.do({:every => 1.hour}.merge(options), &blk)
end

.do_monthly(options = {}, &blk) ⇒ Object



138
139
140
# File 'lib/em-timers/em-timers.rb', line 138

def self.do_monthly(options={}, &blk)
  self.do({:every => 1.month}.merge(options), &blk)
end

.do_weekly(options = {}, &blk) ⇒ Object



134
135
136
# File 'lib/em-timers/em-timers.rb', line 134

def self.do_weekly(options={}, &blk)
  self.do({:every => 1.week}.merge(options), &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

.find_by_tag(tag) ⇒ Object



150
151
152
153
154
# File 'lib/em-timers/em-timers.rb', line 150

def self.find_by_tag(tag)
  Timer.list.find_all { |t|
    t.tag == tag
  }
end

.listObject



146
147
148
# File 'lib/em-timers/em-timers.rb', line 146

def self.list
  Timer.list
end