Module: Resque::SelfLookup

Defined in:
lib/resque/self_lookup.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(receiver) ⇒ Object



12
13
14
15
16
17
# File 'lib/resque/self_lookup.rb', line 12

def self.included(receiver)
  receiver.class_eval do
    alias payload_class_old payload_class
    alias payload_class payload_class_enhanced
  end
end

Instance Method Details

#payload_class_enhancedObject



3
4
5
6
7
8
9
10
# File 'lib/resque/self_lookup.rb', line 3

def payload_class_enhanced
  @payload_class ||= constantize(@payload['class'])
  @payload_class.instance_eval { class << self; self end }.send(:attr_accessor, :worker)
  @payload_class.instance_eval { class << self; self end }.send(:attr_accessor, :job)
  @payload_class.worker =  self.worker
  @payload_class.job =  self
  return @payload_class
end