Sha256: 0cfda40ece66fc5ba4f31faccc53d6f9d4c9f02daa8ebf5f99cc816022dba6b2
Contents?: true
Size: 1.09 KB
Versions: 11
Compression:
Stored size: 1.09 KB
Contents
require 'rufus/scheduler' module Spider; module Worker class Runner def initialize if Gem.loaded_specs['rufus-scheduler'].version.to_s < "3.0.0" @scheduler = Rufus::Scheduler.start_new else @scheduler = Rufus::Scheduler.new end end def stop @scheduler.stop end def join @scheduler.join end def every(time, params=nil, &proc) if (params) @scheduler.every(time) do params[:obj].send(params[:method], *params[:arguments]) end else @scheduler.every(time, &proc) end end def cron(time, params=nil, &proc) if (params) @scheduler.cron(time) do params[:obj].send(params[:method], *params[:arguments]) end else @scheduler.cron(time, &proc) end end end end; end
Version data entries
11 entries across 11 versions & 1 rubygems