Class: HealthRack::Check
- Inherits:
-
Object
- Object
- HealthRack::Check
- Defined in:
- lib/health_rack/check.rb
Instance Attribute Summary collapse
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #error? ⇒ Boolean
-
#initialize(title, &proc) ⇒ Check
constructor
A new instance of Check.
- #perform ⇒ Object
- #status ⇒ Object (also: #status?)
Constructor Details
#initialize(title, &proc) ⇒ Check
Returns a new instance of Check.
7 8 9 10 |
# File 'lib/health_rack/check.rb', line 7 def initialize(title, &proc) @title = title || raise(ArgumentError, "A title must be specified") @proc = proc || raise(ArgumentError, "A block must be specified") end |
Instance Attribute Details
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
5 6 7 |
# File 'lib/health_rack/check.rb', line 5 def duration @duration end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
5 6 7 |
# File 'lib/health_rack/check.rb', line 5 def title @title end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
5 6 7 |
# File 'lib/health_rack/check.rb', line 5 def value @value end |
Instance Method Details
#error? ⇒ Boolean
26 27 28 |
# File 'lib/health_rack/check.rb', line 26 def error? value.is_a? Exception end |
#perform ⇒ Object
12 13 14 15 |
# File 'lib/health_rack/check.rb', line 12 def perform measure value end |
#status ⇒ Object Also known as: status?
17 18 19 20 21 22 |
# File 'lib/health_rack/check.rb', line 17 def status case value when nil, 0, false, Exception then false else true end end |