Module: Modern::Descriptor::Parameters

Defined in:
lib/modern/descriptor/parameters.rb

Defined Under Namespace

Classes: Base, Cookie, Header, Path, Query

Class Method Summary collapse

Class Method Details

.from_inputs(name, parameter_type, opts) ⇒ Object



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/modern/descriptor/parameters.rb', line 131

def self.from_inputs(name, parameter_type, opts)
  opts = opts.merge(name: name.to_s)

  case parameter_type.to_sym
  when :path
    Modern::Descriptor::Parameters::Path.new(opts)
  when :cookie
    Modern::Descriptor::Parameters::Cookie.new(opts)
  when :header
    Modern::Descriptor::Parameters::Header.new(opts)
  when :query
    Modern::Descriptor::Parameters::Query.new(opts)
  else
    raise "Unrecognized parameter type '#{parameter_type}'.'"
  end
end