Method: Cuprum::Utils::ParametersMapping#initialize

Defined in:
lib/cuprum/utils/parameters_mapping.rb

#initialize(arguments: [], keywords: [], block: nil, variadic_arguments: nil, variadic_keywords: nil) ⇒ ParametersMapping

Returns a new instance of ParametersMapping.

Parameters:

  • arguments (Array<Symbol>) (defaults to: [])

    the named arguments to the method, both required and optional, but excluding variadic args).

  • block (Symbol, nil) (defaults to: nil)

    the name of the block parameter, if any.

  • keywords (Array<Symbol>) (defaults to: [])

    the keywords for the method, both required and optional, but excluding variadic keywords.

  • variadic_arguments (Symbol) (defaults to: nil)

    the name of the variadic arguments parameter, if any.

  • variadic_keywords (Symbol) (defaults to: nil)

    the name of the variadic keywords parameter, if any.



58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/cuprum/utils/parameters_mapping.rb', line 58

def initialize(
  arguments:          [],
  keywords:           [],
  block:              nil,
  variadic_arguments: nil,
  variadic_keywords:  nil
)
  @arguments          = arguments.map(&:to_sym).freeze
  @block              = block&.to_sym
  @keywords           = Set.new(keywords.map(&:to_sym)).freeze
  @variadic_arguments = variadic_arguments&.to_sym
  @variadic_keywords  = variadic_keywords&.to_sym
end