Module: ResqueDelayWithMongoid::MessageSending::ClassMethods

Defined in:
lib/resque_delay_with_mongoid/message_sending.rb

Overview

def send_later(method, *args)

warn "[DEPRECATION] `object.send_later(:method)` is deprecated. Use `object.delay.method"
__delay__.__send__(method, *args)

end

def send_at(time, method, *args)

warn "[DEPRECATION] `object.send_at(time, :method)` is deprecated. Use `object.delay(:run_at => time).method"
__delay__(:run_at => time).__send__(method, *args)

end

Instance Method Summary collapse

Instance Method Details

#handle_asynchronously(method) ⇒ Object



39
40
41
42
43
44
45
46
# File 'lib/resque_delay_with_mongoid/message_sending.rb', line 39

def handle_asynchronously(method)
  aliased_method, punctuation = method.to_s.sub(/([?!=])$/, ''), $1
  with_method, without_method = "#{aliased_method}_with_delay#{punctuation}", "#{aliased_method}_without_delay#{punctuation}"
  define_method(with_method) do |*args|
    delay.__send__(without_method, *args)
  end
  alias_method_chain method, :delay
end