Class: RailsRiemannMiddleware::Headers
- Inherits:
-
Object
- Object
- RailsRiemannMiddleware::Headers
- Defined in:
- lib/rails_riemann_middleware/headers.rb
Instance Attribute Summary collapse
-
#env ⇒ Object
readonly
Returns the value of attribute env.
Instance Method Summary collapse
-
#initialize(env) ⇒ Headers
constructor
A new instance of Headers.
- #keys ⇒ Object
- #to_a ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(env) ⇒ Headers
Returns a new instance of Headers.
7 8 9 |
# File 'lib/rails_riemann_middleware/headers.rb', line 7 def initialize(env) @env = env end |
Instance Attribute Details
#env ⇒ Object (readonly)
Returns the value of attribute env.
5 6 7 |
# File 'lib/rails_riemann_middleware/headers.rb', line 5 def env @env end |
Instance Method Details
#keys ⇒ Object
11 12 13 |
# File 'lib/rails_riemann_middleware/headers.rb', line 11 def keys %w{REQUEST_METHOD REQUEST_URI PATH_INFO HTTP_X_REAL_IP HTTP_USER_AGENT HTTP_REFERER} end |
#to_a ⇒ Object
15 16 17 |
# File 'lib/rails_riemann_middleware/headers.rb', line 15 def to_a keys.map { |h| " #{h.downcase}: #{env.fetch(h, "N/A")}" } end |
#to_s ⇒ Object
19 20 21 |
# File 'lib/rails_riemann_middleware/headers.rb', line 19 def to_s to_a.join("\n") end |