Sha256: 9c1dee584fd3c0e70c6403b1e84c85342684a4ff3191dcae19fdc784e1835862
Contents?: true
Size: 952 Bytes
Versions: 1
Compression:
Stored size: 952 Bytes
Contents
module HealthRails class HealthCheck class HealthCheckFailure < Exception end def all_ok? process_checks !errors.any? end def error_messages errors.join("\n") end def errors @errors ||= [] end def process_check(description) begin HealthCheck.check(description).call rescue HealthCheckFailure => error_message errors << "#{description}: #{error_message}" end end def process_checks HealthCheck.checks.each do |description, proc| process_check(description) end end class << self def check(description, &block) if block.nil? checks[description] else checks[description] = block end end def checks @@checks ||= {} end end end end # Load all health checks Dir["#{File.dirname(__FILE__)}/health_checks/**/*.rb"].each { |f| require f }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
health_rails-0.0.1 | lib/health_rails/health_check.rb |