Class: SinatraHealthCheck::Status::OverwritingAggregator
- Inherits:
-
Object
- Object
- SinatraHealthCheck::Status::OverwritingAggregator
- Defined in:
- lib/sinatra-health-check/status/overwriting_aggregator.rb
Overview
Aggregate statuus with an aggregator but allow overwriting :level and :message.
Instance Method Summary collapse
-
#aggregate(statuus, overwrite = nil) ⇒ Object
aggregate statuus with given aggregator, but overwrite :status and :message if overwrite is given too.
-
#initialize(aggregator) ⇒ OverwritingAggregator
constructor
A new instance of OverwritingAggregator.
Constructor Details
#initialize(aggregator) ⇒ OverwritingAggregator
Returns a new instance of OverwritingAggregator.
3 4 5 6 |
# 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 |
Instance Method Details
#aggregate(statuus, overwrite = nil) ⇒ Object
aggregate statuus with given aggregator, but overwrite :status and :message if overwrite is given too
9 10 11 12 13 14 15 |
# 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., statuus) else @aggregator.aggregate(statuus) end end |