lib/delayed/message_sending.rb in collectiveidea-delayed_job-1.8.0 vs lib/delayed/message_sending.rb in collectiveidea-delayed_job-1.8.1
- old
+ new
@@ -4,12 +4,13 @@
Delayed::Job.enqueue Delayed::PerformableMethod.new(self, method.to_sym, args)
end
module ClassMethods
def handle_asynchronously(method)
- without_name = "#{method}_without_send_later"
- define_method("#{method}_with_send_later") do |*args|
- send_later(without_name, *args)
+ aliased_method, punctuation = method.to_s.sub(/([?!=])$/, ''), $1
+ with_method, without_method = "#{aliased_method}_with_send_later#{punctuation}", "#{aliased_method}_without_send_later#{punctuation}"
+ define_method(with_method) do |*args|
+ send_later(without_method, *args)
end
alias_method_chain method, :send_later
end
end
end
\ No newline at end of file