Class: Rack::Healthz::Response
- Inherits:
-
Object
- Object
- Rack::Healthz::Response
- Defined in:
- lib/rack/healthz/response.rb
Instance Attribute Summary collapse
-
#accumulator ⇒ Object
readonly
Returns the value of attribute accumulator.
Instance Method Summary collapse
- #content_type ⇒ Object
- #healthy? ⇒ Boolean
-
#initialize(accumulator) ⇒ Response
constructor
A new instance of Response.
- #return_status ⇒ Object
- #to_a ⇒ Object
- #to_h ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(accumulator) ⇒ Response
Returns a new instance of Response.
6 7 8 |
# File 'lib/rack/healthz/response.rb', line 6 def initialize(accumulator) @accumulator = accumulator end |
Instance Attribute Details
#accumulator ⇒ Object (readonly)
Returns the value of attribute accumulator.
4 5 6 |
# File 'lib/rack/healthz/response.rb', line 4 def accumulator @accumulator end |
Instance Method Details
#content_type ⇒ Object
22 23 24 |
# File 'lib/rack/healthz/response.rb', line 22 def content_type ContentType end |
#healthy? ⇒ Boolean
26 27 28 |
# File 'lib/rack/healthz/response.rb', line 26 def healthy? accumulator.healthy? end |
#return_status ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/rack/healthz/response.rb', line 30 def return_status if healthy? HealthyStatus else UnhealthyStatus end end |
#to_a ⇒ Object
10 11 12 |
# File 'lib/rack/healthz/response.rb', line 10 def to_a [return_status, content_type, [to_json]] end |
#to_h ⇒ Object
18 19 20 |
# File 'lib/rack/healthz/response.rb', line 18 def to_h accumulator.to_h end |
#to_json ⇒ Object
14 15 16 |
# File 'lib/rack/healthz/response.rb', line 14 def to_json to_h.to_json end |