Class: Modern::Descriptor::Parameters::Header
- Defined in:
- lib/modern/descriptor/parameters.rb
Instance Attribute Summary collapse
-
#rack_env_key ⇒ Object
readonly
Returns the value of attribute rack_env_key.
Instance Method Summary collapse
- #do_retrieve(request, _route_captures = nil) ⇒ Object
- #friendly_name ⇒ Object
-
#initialize(fields) ⇒ Header
constructor
A new instance of Header.
Methods inherited from Base
#openapi3_in, #retrieve, #to_openapi3
Methods included from Struct::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_key ⇒ Object (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_name ⇒ Object
96 97 98 |
# File 'lib/modern/descriptor/parameters.rb', line 96 def friendly_name header_name end |