Class: Clockwork::DatabaseEvents::Manager

Inherits:
Manager
  • Object
show all
Defined in:
lib/clockwork/database_events/manager.rb

Instance Attribute Summary

Attributes inherited from Manager

#config

Instance Method Summary collapse

Methods inherited from Manager

#configure, #default_configuration, #error_handler, #every, #fire_callbacks, #graceful_shutdown, #handle_error, #handle_signal, #handler, #initialize, #log, #log_error, #logger, #on, #run, #run_tick_loop, #shutdown, #stop_tick_loop, #thread_available?, #tick, #wait_tick_loop_finishes

Constructor Details

This class inherits a constructor from Clockwork::Manager

Instance Method Details

#register(period, job, block, options) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/clockwork/database_events/manager.rb', line 11

def register(period, job, block, options)
  @events << if options[:from_database]
    synchronizer = options.fetch(:synchronizer)
    model_attributes = options.fetch(:model_attributes)

    Clockwork::DatabaseEvents::Event.
      new(self, period, job, (block || handler), synchronizer, model_attributes, options)
  else
    Clockwork::Event.new(self, period, job, block || handler, options)
  end
end

#unregister(event) ⇒ Object



7
8
9
# File 'lib/clockwork/database_events/manager.rb', line 7

def unregister(event)
  @events.delete(event)
end