Class: Leafy::Health::Registry
- Inherits:
-
Object
- Object
- Leafy::Health::Registry
- Defined in:
- lib/leafy/health/registry.rb
Instance Attribute Summary collapse
-
#health ⇒ Object
readonly
state ofthe registry.
Instance Method Summary collapse
-
#initialize ⇒ Registry
constructor
A new instance of Registry.
-
#names ⇒ Array<String>
the names of all registered HealthCheck.
-
#register(name, check = nil) {|which| ... } ⇒ Object
register a HealthCheck under a given name.
-
#unregister(name) ⇒ Object
unregister a HealthCheck for a given name.
Constructor Details
#initialize ⇒ Registry
Returns a new instance of Registry.
10 11 12 |
# File 'lib/leafy/health/registry.rb', line 10 def initialize @health = com.codahale.metrics.health.HealthCheckRegistry.new end |
Instance Attribute Details
#health ⇒ Object (readonly)
state ofthe registry
8 9 10 |
# File 'lib/leafy/health/registry.rb', line 8 def health @health end |
Instance Method Details
#names ⇒ Array<String>
the names of all registered HealthCheck
42 43 44 |
# File 'lib/leafy/health/registry.rb', line 42 def names @health.names.to_a end |
#register(name, check = nil) {|which| ... } ⇒ Object
register a HealthCheck under a given name
22 23 24 25 26 27 28 29 30 |
# File 'lib/leafy/health/registry.rb', line 22 def register(name, check = nil, &block ) if check and not block_given? and check.is_a? com.codahale.metrics.health.HealthCheck @health.register( name, check ) elsif check.nil? and block_given? @health.register( name, HealthCheck.new( &block ) ) else raise 'needs either a block and object with call method' end end |
#unregister(name) ⇒ Object
unregister a HealthCheck for a given name
35 36 37 |
# File 'lib/leafy/health/registry.rb', line 35 def unregister(name) @health.unregister(name) end |