Class: SinatraHealthCheck::Status::StrictAggregator

Inherits:
Object
  • Object
show all
Defined in:
lib/sinatra-health-check/status/strict_aggregator.rb

Overview

Aggregate sub statuus, worst wins

Instance Method Summary collapse

Instance Method Details

#aggregate(statuus) ⇒ Object



3
4
5
6
7
8
# File 'lib/sinatra-health-check/status/strict_aggregator.rb', line 3

def aggregate(statuus)
  status = statuus.values.max_by { |s| s.to_i } || SinatraHealthCheck::Status.new(:ok, 'everything is fine')
  message = status.level == :ok ? 'everything is fine' : "at least one status is #{status.level}"

  SinatraHealthCheck::Status::Aggregated.new(status.level, message, statuus)
end