Class: Clockwork::DatabaseEvents::Event

Inherits:
Event
  • Object
show all
Defined in:
lib/clockwork/database_events/event.rb

Instance Attribute Summary collapse

Attributes inherited from Event

#job, #last

Instance Method Summary collapse

Methods inherited from Event

#convert_timezone, #run, #run_now?, #thread?

Constructor Details

#initialize(manager, period, job, block, sync_performer, options = {}) ⇒ Event

Returns a new instance of Event


9
10
11
12
13
# File 'lib/clockwork/database_events/event.rb', line 9

def initialize(manager, period, job, block, sync_performer, options={})
  super(manager, period, job, block, options)
  @sync_performer = sync_performer
  @sync_performer.register(self, job)
end

Instance Attribute Details

#atObject

Returns the value of attribute at


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

def at
  @at
end

#sync_performerObject

Returns the value of attribute sync_performer


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

def sync_performer
  @sync_performer
end

Instance Method Details

#nameObject


15
16
17
# File 'lib/clockwork/database_events/event.rb', line 15

def name
  (job.respond_to?(:name) && job.name) ? job.name : "#{job.class}:#{job.id}"
end

#name_or_frequency_has_changed?(model) ⇒ Boolean

Returns:

  • (Boolean)

23
24
25
# File 'lib/clockwork/database_events/event.rb', line 23

def name_or_frequency_has_changed?(model)
  name_has_changed?(model) || frequency_has_changed?(model)
end

#to_sObject


19
20
21
# File 'lib/clockwork/database_events/event.rb', line 19

def to_s
  name
end