Class: Modern::Descriptor::Parameters::Header

Inherits:
Base
  • Object
show all
Defined in:
lib/modern/descriptor/parameters.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#openapi3_in, #retrieve, #to_openapi3

Methods included from Struct::Copy

#copy

Constructor Details

#initialize(fields) ⇒ Header

Returns a new instance of Header.



90
91
92
93
94
# File 'lib/modern/descriptor/parameters.rb', line 90

def initialize(fields)
  super(fields)

  @rack_env_key = "HTTP_" + header_name.upcase.tr("-", "_")
end

Instance Attribute Details

#rack_env_keyObject (readonly)

Returns the value of attribute rack_env_key.



88
89
90
# File 'lib/modern/descriptor/parameters.rb', line 88

def rack_env_key
  @rack_env_key
end

Instance Method Details

#do_retrieve(request, _route_captures = nil) ⇒ Object



100
101
102
# File 'lib/modern/descriptor/parameters.rb', line 100

def do_retrieve(request, _route_captures = nil)
  request.env[@rack_env_key]
end

#friendly_nameObject



96
97
98
# File 'lib/modern/descriptor/parameters.rb', line 96

def friendly_name
  header_name
end