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