Module: TResque::Delay::ClassMethods

Defined in:
lib/tresque/delay.rb

Instance Method Summary collapse

Instance Method Details

#async(method_name, options = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/tresque/delay.rb', line 12

def async(method_name, options = {})
  raise "Attempted to handle #{self.name}##{method_name} asyncronously but #{method_name} was not yet defined" unless (self.instance_methods + self.private_instance_methods).include?(method_name)

  class_eval "    def \#{method_name}_with_delay(*args)\n      self.delay(\#{options.inspect}).\#{method_name}_without_delay(*args)\n    end\n    alias_method_chain :\#{method_name}, :delay\n  EV\nend\n", __FILE__, __LINE__ + 1

#delay(options = {}) ⇒ Object



7
8
9
# File 'lib/tresque/delay.rb', line 7

def delay(options = {})
  InvocationProxy.new(self, options)
end