module PerformEvery::ActiveJobExtension

Public Instance Methods

perform_at(timestamp, opts = {}) click to toggle source
# File lib/perform_every/activejob.rb, line 24
def perform_at(timestamp, opts = {})
  j = Job.new
  j.job_name = self.name
  j.typ = "timestamp"
  j.value = timestamp.strip
  j.accuracy = opts[:accuracy]

  if j.value.blank?
    raise "#{self.name}#perform_at needs timestamp"
  end

  PerformEvery::Reflection.insert(j)
end
perform_every(interval, opts = {}) click to toggle source
# File lib/perform_every/activejob.rb, line 10
def perform_every(interval, opts = {})
  j = Job.new
  j.job_name = self.name
  j.typ = "interval"
  j.value = interval.strip
  j.accuracy = opts[:accuracy]

  if j.value.blank?
    raise "#{self.name}#perform_every needs interval"
  end

  PerformEvery::Reflection.insert(j)
end