Class: Datadog::Tracing::Contrib::Rack::Header::RequestHeaderCollection
- Inherits:
-
Core::HeaderCollection
- Object
- Core::HeaderCollection
- Datadog::Tracing::Contrib::Rack::Header::RequestHeaderCollection
- Defined in:
- lib/datadog/tracing/contrib/rack/header_collection.rb
Overview
An implementation of a header collection that looks up headers from a Rack environment.
Instance Method Summary collapse
-
#get(header_name) ⇒ Object
(also: #[])
Gets the value of the header with the given name.
-
#initialize(env) ⇒ RequestHeaderCollection
constructor
Creates a header collection from a rack environment.
-
#key?(header_name) ⇒ Boolean
Tests whether a header with the given name exists in the environment.
Methods inherited from Core::HeaderCollection
Constructor Details
#initialize(env) ⇒ RequestHeaderCollection
Creates a header collection from a rack environment.
14 15 16 17 |
# File 'lib/datadog/tracing/contrib/rack/header_collection.rb', line 14 def initialize(env) super() @env = env end |
Instance Method Details
#get(header_name) ⇒ Object Also known as: []
Gets the value of the header with the given name.
20 21 22 |
# File 'lib/datadog/tracing/contrib/rack/header_collection.rb', line 20 def get(header_name) @env[Header.to_rack_header(header_name)] end |
#key?(header_name) ⇒ Boolean
Tests whether a header with the given name exists in the environment.
28 29 30 |
# File 'lib/datadog/tracing/contrib/rack/header_collection.rb', line 28 def key?(header_name) @env.key?(Header.to_rack_header(header_name)) end |