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, event_store, 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, event_store, options={})
  super(manager, period, job, block, options)
  @event_store = event_store
  @event_store.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

#event_storeObject

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

Instance Method Details

#frequencyObject



27
28
29
# File 'lib/clockwork/database_events/event.rb', line 27

def frequency
  @period
end

#job_has_name?Boolean

Returns:

  • (Boolean)


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

def job_has_name?
  job.respond_to?(:name)
end

#nameObject



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

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

#to_sObject



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

def to_s
  name
end