lib/clockwork/manager.rb in clockwork-1.1.0 vs lib/clockwork/manager.rb in clockwork-1.2.0
- old
+ new
@@ -40,10 +40,14 @@
def on(event, options={}, &block)
raise "Unsupported callback #{event}" unless [:before_tick, :after_tick, :before_run, :after_run].include?(event.to_sym)
(@callbacks[event.to_sym]||=[]) << block
end
- def every(period, job, options={}, &block)
+ def every(period, job='unnamed', options={}, &block)
+ if job.is_a?(Hash) and options.empty?
+ options = job
+ job = "unnamed"
+ end
if options[:at].respond_to?(:each)
every_with_multiple_times(period, job, options, &block)
else
register(period, job, block, options)
end