Class: Philiprehberger::CircuitBoard::Configuration
- Inherits:
-
Object
- Object
- Philiprehberger::CircuitBoard::Configuration
- Defined in:
- lib/philiprehberger/circuit_board/configuration.rb
Overview
DSL for defining health checks.
Instance Attribute Summary collapse
-
#checks ⇒ Object
readonly
Returns the value of attribute checks.
Instance Method Summary collapse
-
#check(name, timeout: 5, critical: true, cache: nil, &block) ⇒ void
Register a health check.
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#on_change {|Symbol, Symbol| ... } ⇒ void
Register a callback for health status transitions.
-
#on_change_callback ⇒ Proc?
The on_change callback.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
9 10 11 12 |
# File 'lib/philiprehberger/circuit_board/configuration.rb', line 9 def initialize @checks = [] @on_change = nil end |
Instance Attribute Details
#checks ⇒ Object (readonly)
Returns the value of attribute checks.
7 8 9 |
# File 'lib/philiprehberger/circuit_board/configuration.rb', line 7 def checks @checks end |
Instance Method Details
#check(name, timeout: 5, critical: true, cache: nil, &block) ⇒ void
This method returns an undefined value.
Register a health check.
22 23 24 |
# File 'lib/philiprehberger/circuit_board/configuration.rb', line 22 def check(name, timeout: 5, critical: true, cache: nil, &block) @checks << Check.new(name, timeout: timeout, critical: critical, cache: cache, &block) end |
#on_change {|Symbol, Symbol| ... } ⇒ void
This method returns an undefined value.
Register a callback for health status transitions.
30 31 32 |
# File 'lib/philiprehberger/circuit_board/configuration.rb', line 30 def on_change(&block) @on_change = block end |
#on_change_callback ⇒ Proc?
Returns the on_change callback.
35 36 37 |
# File 'lib/philiprehberger/circuit_board/configuration.rb', line 35 def on_change_callback @on_change end |