Class: Clockwork::DatabaseEvents::Event
- Defined in:
- lib/clockwork/database_events/event.rb
Instance Attribute Summary collapse
-
#event_store ⇒ Object
Returns the value of attribute event_store.
-
#model_attributes ⇒ Object
Returns the value of attribute model_attributes.
Attributes inherited from Event
Instance Method Summary collapse
- #frequency ⇒ Object
-
#initialize(manager, period, job, block, event_store, model_attributes, options = {}) ⇒ Event
constructor
A new instance of Event.
- #job_has_name? ⇒ Boolean
- #name ⇒ Object
- #to_s ⇒ Object
Methods inherited from Event
#convert_timezone, #run, #run_now?, #thread?
Constructor Details
#initialize(manager, period, job, block, event_store, model_attributes, options = {}) ⇒ Event
Returns a new instance of Event.
9 10 11 12 13 14 |
# File 'lib/clockwork/database_events/event.rb', line 9 def initialize(manager, period, job, block, event_store, model_attributes, ={}) super(manager, period, job, block, ) @event_store = event_store @event_store.register(self, job) @model_attributes = model_attributes end |
Instance Attribute Details
#event_store ⇒ Object
Returns the value of attribute event_store.
7 8 9 |
# File 'lib/clockwork/database_events/event.rb', line 7 def event_store @event_store end |
#model_attributes ⇒ Object
Returns the value of attribute model_attributes.
7 8 9 |
# File 'lib/clockwork/database_events/event.rb', line 7 def model_attributes @model_attributes end |
Instance Method Details
#frequency ⇒ Object
28 29 30 |
# File 'lib/clockwork/database_events/event.rb', line 28 def frequency @period end |
#job_has_name? ⇒ Boolean
20 21 22 |
# File 'lib/clockwork/database_events/event.rb', line 20 def job_has_name? job.respond_to?(:name) end |
#name ⇒ Object
16 17 18 |
# File 'lib/clockwork/database_events/event.rb', line 16 def name (job_has_name? && job.name) ? job.name : "#{job.class}:#{job.id}" end |
#to_s ⇒ Object
24 25 26 |
# File 'lib/clockwork/database_events/event.rb', line 24 def to_s name end |