Module: ResqueDelayable::ClassMethods

Defined in:
lib/resque-delayable.rb

Instance Method Summary collapse

Instance Method Details

#perform(cmd, instance, *args) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/resque-delayable.rb', line 46

def perform(cmd, instance, *args)
  deserialized_args = ::ResqueDelayable.deserialize_object(args)

  if instance
    # Instance method 
    deserialized_instance = ::ResqueDelayable.deserialize_object(instance)
    if deserialized_instance
      deserialized_instance.send(cmd, *deserialized_args)
    else
      puts "ResqueDelayable couldn't find instance '#{instance}' to peform method '#{cmd}' on"
    end
  else
    # Class method
    send(cmd, *deserialized_args)
  end
end

#queueObject



63
64
65
# File 'lib/resque-delayable.rb', line 63

def queue
  @queue ||= self.name
end

#rdelay(options = {}) ⇒ Object



42
43
44
# File 'lib/resque-delayable.rb', line 42

def rdelay(options = {})
  return DelayedMethod.new(self, nil, options)
end