Class: RunEvery

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

Defined Under Namespace

Classes: TimeUnit

Instance Method Summary collapse

Constructor Details

#initialize(opt = {}, &blk) ⇒ RunEvery

Returns a new instance of RunEvery.



9
10
11
12
13
14
15
16
# File 'lib/run_every.rb', line 9

def initialize(opt={}, &blk)
  if opt[:minutes] then
    interval = opt[:minutes] * 60
  elsif opt[:seconds] then
    interval = opt[:seconds]
  end
  start_timer(interval, &blk)    
end

Instance Method Details

#minute(&blk) ⇒ Object



56
57
58
# File 'lib/run_every.rb', line 56

def minute(&blk)
  start_timer(60, &blk)
end