Sha256: 82deb4f7008034d923a7beae2e4bc8212d78157a0011503ed3ef2aa329dd91ad
Contents?: true
Size: 727 Bytes
Versions: 2
Compression:
Stored size: 727 Bytes
Contents
module Health class Checker def checks @checks ||= {} end def check(name_or_object, &block) if name_or_object.respond_to?(:call) checks[name_or_object.name.to_sym] = name_or_object else checks[name_or_object.to_sym] = block end end def has_check?(name) checks.has_key?(name.to_sym) end def names checks.keys end def perform(name) checks[name.to_sym].call.tap do |result| assert_necessary_keys(result) end end private def assert_necessary_keys(result) (result.has_key?(:ok) && result.has_key?(:output)) || raise("Check results MUST have :ok and :output keys.") end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
health-0.0.4 | lib/health/checker.rb |
health-0.0.3 | lib/health/checker.rb |