lib/clockwork/manager.rb in clockwork-0.6.1 vs lib/clockwork/manager.rb in clockwork-0.6.2

- old
+ new

@@ -30,10 +30,18 @@ def get_handler raise NoHandlerDefined unless (defined?(@handler) and @handler) @handler end + def error_handler(&block) + @error_handler = block + end + + def get_error_handler + @error_handler + end + 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 @@ -97,10 +105,10 @@ options[:thread] = !!(options.has_key?(:thread) ? options[:thread] : config[:thread]) options[:tz] ||= config[:tz] options end - + def every_with_multiple_times(period, job, options={}, &block) each_options = options.clone options[:at].each do |at| each_options[:at] = at register(period, job, block, each_options)