Method: OpenApi::Parameter#initialize
- Defined in:
- lib/open_api/parameter.rb
#initialize(name:, in:, description: nil, required: nil, deprecated: nil, allow_empty_value: nil, **other_fields_hash) ⇒ Parameter
Returns a new instance of Parameter.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/open_api/parameter.rb', line 8 def initialize(name:, in:, description: nil, required: nil, deprecated: nil, allow_empty_value: nil, **other_fields_hash) self.name = name self.in = binding.local_variable_get(:in) # `in` is reserved keyword self.required = required self.deprecated = deprecated self.allow_empty_value = allow_empty_value self.other_fields_hash = other_fields_hash.with_indifferent_access other_fields_hash.keys.each do |key| define_singleton_method(key) do other_fields_hash[key] end define_singleton_method("#{key}=") do |value| other_fields_hash[key] = value end end end |