module ActionExtractor::ActionArgumentsTakable

Public Instance Methods

send_action(method_name, *arguments) click to toggle source

@note Override.

Calls superclass method
# File lib/action_extractor/action_arguments_takable.rb, line 6
def send_action(method_name, *arguments)
  extraction = self.class.extractions[method_name]
  if extraction
    keyword_arguments = extraction.definitions.each_with_object({}) do |(argument_name, definition), object|
      extractor = Extractors::Base.extractors[definition[:from]]
      unless extractor
        raise ::ArgumentError, "Unknown :from value in `.extract` arguments: `#{definition[:from].inspect}`."
      end

      object[argument_name] = extractor.call(
        argument_name: argument_name,
        controller: self,
        definition: definition
      )
    end
    super(
      method_name,
      *arguments,
      **keyword_arguments,
    )
  else
    super
  end
end