Module Delayed::MessageSending::ClassMethods
In: lib/delayed/message_sending.rb

Methods

Public Instance methods

[Source]

    # File lib/delayed/message_sending.rb, line 34
34:       def handle_asynchronously(method, opts = {})
35:         aliased_method, punctuation = method.to_s.sub(/([?!=])$/, ''), $1
36:         with_method, without_method = "#{aliased_method}_with_delay#{punctuation}", "#{aliased_method}_without_delay#{punctuation}"
37:         define_method(with_method) do |*args|
38:           curr_opts = opts.clone
39:           curr_opts.each_key do |key|
40:             if (val = curr_opts[key]).is_a?(Proc)
41:               curr_opts[key] = if val.arity == 1
42:                 val.call(self)
43:               else
44:                 val.call
45:               end
46:             end
47:           end
48:           delay(curr_opts).__send__(without_method, *args)
49:         end
50:         alias_method_chain method, :delay
51:       end

[Validate]