Method: Parameters::Options.accepts

Defined in:
lib/parameters/options.rb

.accepts(param) ⇒ Class

Returns the OptionParser acceptance class for the parameter.

Parameters:

  • param (Param)

    The parameter.

Returns:

  • (Class)

    The acceptance class.

Since:

  • 0.4.0



103
104
105
106
107
108
109
110
111
112
113
# File 'lib/parameters/options.rb', line 103

def self.accepts(param)
  type = param.type

  if type <= Types::Hash
    Hash
  elsif type <= Types::Array
    Array
  else
    ACCEPTS[type]
  end
end