Class: ActiveSupport::Callbacks::CallTemplate::MethodCall
Do not use. This class is for internal use only.
Relationships & Source Files | |
Inherits: | Object |
Defined in: | activesupport/lib/active_support/callbacks.rb |
Class Method Summary
- .new(method) ⇒ MethodCall constructor
Instance Method Summary
-
#expand(target, value, block)
Return the parts needed to make this call, with the given input values.
- #inverted_lambda
- #make_lambda
Constructor Details
.new(method) ⇒ MethodCall
# File 'activesupport/lib/active_support/callbacks.rb', line 338
def initialize(method) @method_name = method end
Instance Method Details
#expand(target, value, block)
Return the parts needed to make this call, with the given input values.
Returns an array of the form:
[target, block, method, *arguments]
This array can be used as such:
target.send(method, *arguments, &block)
The actual invocation is left up to the caller to minimize call stack pollution.
# File 'activesupport/lib/active_support/callbacks.rb', line 355
def (target, value, block) [target, block, @method_name] end
#inverted_lambda
[ GitHub ]# File 'activesupport/lib/active_support/callbacks.rb', line 365
def inverted_lambda lambda do |target, value, &block| !target.send(@method_name, &block) end end
#make_lambda
[ GitHub ]# File 'activesupport/lib/active_support/callbacks.rb', line 359
def make_lambda lambda do |target, value, &block| target.send(@method_name, &block) end end