Method: OpenApi::Header#initialize

Defined in:
lib/open_api/header.rb

#initialize(description: nil, required: false, deprecated: nil, allow_empty_value: false, **other_fields_hash) ⇒ Header

Returns a new instance of Header.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/open_api/header.rb', line 8

def initialize(description: nil, required: false, deprecated: nil, allow_empty_value: false, **other_fields_hash)
  self.description = description
  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 |field_name|
    define_singleton_method(field_name) do
      other_fields_hash[field_name]
    end
    define_singleton_method("#{field_name}=") do |value|
      other_fields_hash[field_name] = value
    end
  end
end