Module: ActionArgs::ActiveSupport::CallTemplate::MethodCallParameterizer

Defined in:
lib/action_args/callbacks.rb

Instance Method Summary collapse

Instance Method Details

#make_lambdaObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/action_args/callbacks.rb', line 10

def make_lambda
  lambda do |target, value, &block|
    if ActionController::Base === target
      target.strengthen_params! @method_name
      arguments, keyword_arguments = target.extract_method_arguments_from_params @method_name
      if keyword_arguments.any?
        target.send(@method_name, *arguments, **keyword_arguments, &block)
      else
        target.send(@method_name, *arguments, &block)
      end
    else
      target.send(@method_name, &block)
    end
  end
end