Module: Delayed::Job::Extras::ClassMethods

Defined in:
lib/delayed_job_extras/extras.rb

Overview

InstanceMethods

Constant Summary collapse

@@logger =
SplitLogger.new

Instance Method Summary collapse

Instance Method Details

#enqueue(*args) ⇒ Object



103
104
105
# File 'lib/delayed_job_extras/extras.rb', line 103

def enqueue(*args)
  self.new(*args).enqueue
end

#is_uniqueObject



97
98
99
100
101
# File 'lib/delayed_job_extras/extras.rb', line 97

def is_unique
  define_method('unique?') do
    return true
  end
end

#loggerObject



80
81
82
# File 'lib/delayed_job_extras/extras.rb', line 80

def logger
  @@logger
end

#logger=(logger) ⇒ Object



84
85
86
# File 'lib/delayed_job_extras/extras.rb', line 84

def logger=(logger)
  @@logger = logger
end

#priority(level = 0) ⇒ Object



88
89
90
91
92
93
94
95
# File 'lib/delayed_job_extras/extras.rb', line 88

def priority(level = 0)
  define_method('priority') do
    if level.is_a?(Symbol)
      level = Delayed::Job::Extras::PRIORITY_LEVELS[level] ||= 0
    end
    return @priority ||= level
  end
end

#re_enqueue(&block) ⇒ Object



107
108
109
110
111
112
113
114
# File 'lib/delayed_job_extras/extras.rb', line 107

def re_enqueue(&block)
  define_method('re_enqueuable') do
    true
  end
  define_method('__re_enqueue_block') do
    block
  end
end