Class: Steto::ProcCheck
Instance Attribute Summary collapse
-
#block ⇒ Object
Returns the value of attribute block.
Attributes inherited from BaseCheck
Instance Method Summary collapse
- #check ⇒ Object
-
#initialize(attributes = {}, &block) ⇒ ProcCheck
constructor
A new instance of ProcCheck.
- #status_from_response(response) ⇒ Object
Methods inherited from BaseCheck
#attributes=, #check_if_needed, #status, #status=, #to_json
Constructor Details
#initialize(attributes = {}, &block) ⇒ ProcCheck
Returns a new instance of ProcCheck.
6 7 8 9 |
# File 'lib/steto/proc_check.rb', line 6 def initialize(attributes = {}, &block) self.attributes = attributes self.block = block end |
Instance Attribute Details
#block ⇒ Object
Returns the value of attribute block.
4 5 6 |
# File 'lib/steto/proc_check.rb', line 4 def block @block end |
Instance Method Details
#check ⇒ Object
11 12 13 |
# File 'lib/steto/proc_check.rb', line 11 def check self.status = status_from_response(block.call) end |
#status_from_response(response) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/steto/proc_check.rb', line 15 def status_from_response(response) case response when Steto::Status response when Symbol Status.new(response) when true Status.new(:ok) when false Status.new(:critical) when nil Status.new(:unknown) end end |