class RunEvery
Public Class Methods
new(opt={}, &blk)
click to toggle source
# 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, opt, &blk) end
Public Instance Methods
fifteen()
click to toggle source
# File lib/run_every.rb, line 48 def fifteen() TimeUnit.new 15 end
fifty()
click to toggle source
# File lib/run_every.rb, line 53 def fifty() TimeUnit.new 50 end
five()
click to toggle source
# File lib/run_every.rb, line 46 def five() TimeUnit.new 5 end
forty()
click to toggle source
# File lib/run_every.rb, line 52 def forty() TimeUnit.new 40 end
four()
click to toggle source
# File lib/run_every.rb, line 45 def four() TimeUnit.new 4 end
minute(&blk)
click to toggle source
# File lib/run_every.rb, line 56 def minute(&blk) start_timer(60, &blk) end
one()
click to toggle source
# File lib/run_every.rb, line 42 def one() TimeUnit.new 1 end
ten()
click to toggle source
# File lib/run_every.rb, line 47 def ten() TimeUnit.new 10 end
thirty()
click to toggle source
# File lib/run_every.rb, line 51 def thirty() TimeUnit.new 30 end
three()
click to toggle source
# File lib/run_every.rb, line 44 def three() TimeUnit.new 3 end
twenty()
click to toggle source
# File lib/run_every.rb, line 49 def twenty() TimeUnit.new 20 end
twentyfive()
click to toggle source
# File lib/run_every.rb, line 50 def twentyfive() TimeUnit.new 20 end
two()
click to toggle source
# File lib/run_every.rb, line 43 def two() TimeUnit.new 2 end
Private Instance Methods
start_timer(interval, opt={},&blk)
click to toggle source
# File lib/run_every.rb, line 62 def start_timer(interval, opt={},&blk) thread_name = opt[:thread_name] || 'every' XThreads.new.create_loop(thread_name, interval: interval, &blk).start end