Class: DelayedCron::CronJob

Inherits:
Object
  • Object
show all
Defined in:
lib/delayed_cron/cron_job.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ CronJob

Returns a new instance of CronJob.



6
7
8
9
10
11
# File 'lib/delayed_cron/cron_job.rb', line 6

def initialize(options)
  self.klass = options.delete(:klass)
  self.method_name = options.delete(:method_name)

  self.raw_options = options
end

Instance Attribute Details

#klassObject

Returns the value of attribute klass.



4
5
6
# File 'lib/delayed_cron/cron_job.rb', line 4

def klass
  @klass
end

#method_nameObject

Returns the value of attribute method_name.



4
5
6
# File 'lib/delayed_cron/cron_job.rb', line 4

def method_name
  @method_name
end

Instance Method Details

#enqueue(processor) ⇒ Object



13
14
15
16
17
# File 'lib/delayed_cron/cron_job.rb', line 13

def enqueue(processor)
  schedule.each do |opts|
    processor.enqueue_delayed_cron(klass, method_name, opts)
  end
end