class SinatraHealthCheck::Status::OverwritingAggregator

Aggregate statuus with an aggregator but allow overwriting :level and :message.

Public Class Methods

new(aggregator) click to toggle source
# File lib/sinatra-health-check/status/overwriting_aggregator.rb, line 3
def initialize(aggregator)
  raise ArgumentError, 'aggregator must respond to .aggregate' unless aggregator.respond_to?(:aggregate)
  @aggregator = aggregator
end

Public Instance Methods

aggregate(statuus, overwrite = nil) click to toggle source

aggregate statuus with given aggregator, but overwrite :status and :message if overwrite is given too

# File lib/sinatra-health-check/status/overwriting_aggregator.rb, line 9
def aggregate(statuus, overwrite = nil)
  if overwrite
    SinatraHealthCheck::Status::Aggregated.new(overwrite.level, overwrite.message, statuus)
  else
    @aggregator.aggregate(statuus)
  end
end