Class: Updawg::Check
- Inherits:
-
Object
show all
- Defined in:
- lib/updawg/checks/check.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(name, options = {}, &block) ⇒ Check
Returns a new instance of Check.
16
17
18
19
20
|
# File 'lib/updawg/checks/check.rb', line 16
def initialize(name, options = {}, &block)
@name = name
@block = block
@timeout = options.delete(:timeout) || Updawg.configuration.timeout
end
|
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
14
15
16
|
# File 'lib/updawg/checks/check.rb', line 14
def name
@name
end
|
Instance Method Details
#error(message = nil) ⇒ Object
38
39
40
|
# File 'lib/updawg/checks/check.rb', line 38
def error(message = nil)
Updawg::Result.new(name, :error, message)
end
|
#error!(message = nil) ⇒ Object
#pass(message = nil) ⇒ Object
30
31
32
|
# File 'lib/updawg/checks/check.rb', line 30
def pass(message = nil)
Updawg::Result.new(name, :pass, message)
end
|
#pass!(message = nil) ⇒ Object
22
23
24
25
26
27
28
|
# File 'lib/updawg/checks/check.rb', line 22
def perform
result = execute_check
return result if result.kind_of?(Result)
pass
rescue RuntimeError => e
error e.message
end
|
#warning(message = nil) ⇒ Object
34
35
36
|
# File 'lib/updawg/checks/check.rb', line 34
def warning(message = nil)
Updawg::Result.new(name, :warning, message)
end
|
#warning!(message = nil) ⇒ Object