Class: SinatraHealthCheck::Status::Aggregated
- Inherits:
-
SinatraHealthCheck::Status
- Object
- SinatraHealthCheck::Status
- SinatraHealthCheck::Status::Aggregated
- Defined in:
- lib/sinatra-health-check/status/aggregated.rb
Overview
Application status definition with subsystems
Constant Summary
Constants inherited from SinatraHealthCheck::Status
Instance Attribute Summary collapse
-
#statuus ⇒ Object
readonly
Returns the value of attribute statuus.
Attributes inherited from SinatraHealthCheck::Status
Instance Method Summary collapse
-
#initialize(level, message, statuus, extras = {}) ⇒ Aggregated
constructor
A new instance of Aggregated.
- #to_h ⇒ Object
Methods inherited from SinatraHealthCheck::Status
Constructor Details
#initialize(level, message, statuus, extras = {}) ⇒ Aggregated
Returns a new instance of Aggregated.
6 7 8 9 10 |
# File 'lib/sinatra-health-check/status/aggregated.rb', line 6 def initialize(level, , statuus, extras = {}) raise ArgumentError, "statuus must be a hash of SinatraHealthCheck::Status, but is #{statuus.class}" \ unless statuus.is_a?(Hash) super(level, , { :statusDetails => statuus }.merge(extras)) end |
Instance Attribute Details
#statuus ⇒ Object (readonly)
Returns the value of attribute statuus.
4 5 6 |
# File 'lib/sinatra-health-check/status/aggregated.rb', line 4 def statuus @statuus end |
Instance Method Details
#to_h ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/sinatra-health-check/status/aggregated.rb', line 12 def to_h subs = {} extras[:statusDetails].each { |k,v| subs[k] = v.to_h } s = extras.merge({ :status => level.to_s.upcase, :message => , :statusDetails => subs }) s.delete(:statusDetails) if s[:statusDetails].size == 0 s end |