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.
12 13 14 15 |
# File 'lib/datadog/tracing/contrib/rack/header_collection.rb', line 12 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.
18 19 20 |
# File 'lib/datadog/tracing/contrib/rack/header_collection.rb', line 18 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.
26 27 28 |
# File 'lib/datadog/tracing/contrib/rack/header_collection.rb', line 26 def key?(header_name) @env.key?(Header.to_rack_header(header_name)) end |