Sha256: b81a709295e0235f7625482e801c7071bea0248153f547308f643e93eaa6e1d9
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
module Diagnostics module Methods DIAGNOSTIC_MESSAGES = { :passed => 'All Systems Operational', :warning => 'Experiencing Issues', :failed => 'System Failure', :none => 'No Diagnostic Checks Run' } def diagnostic_checks Diagnostics.checks end def diagnostic_check(name, &block) block ? Check.add(name, &block) : Check.find(name) end def diagnostic_message case diagnostic_status when :passed then DIAGNOSTIC_MESSAGES[:passed] when :warning then DIAGNOSTIC_MESSAGES[:warning] when :failed then DIAGNOSTIC_MESSAGES[:failed] when :none then DIAGNOSTIC_MESSAGES[:none] end end def diagnostic_status return :failed if diagnostic_statuses.include?(:failed) return :warning if diagnostic_statuses.include?(:warning) return :passed if diagnostic_statuses.include?(:passed) :none end private def diagnostic_statuses @diagnostic_statuses ||= diagnostic_checks.map(&:status).uniq end end end class Object include Diagnostics::Methods end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
diagnostics-0.0.2 | lib/diagnostics/methods.rb |