Class: ISPMonitor::Checks::BaseCheck
- Inherits:
-
Object
- Object
- ISPMonitor::Checks::BaseCheck
- Defined in:
- lib/isp_monitor/checks/base_check.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#interval ⇒ Object
readonly
Returns the value of attribute interval.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #check ⇒ Object
-
#initialize(config) ⇒ BaseCheck
constructor
A new instance of BaseCheck.
- #run ⇒ Object
Constructor Details
#initialize(config) ⇒ BaseCheck
Returns a new instance of BaseCheck.
4 5 6 7 8 |
# File 'lib/isp_monitor/checks/base_check.rb', line 4 def initialize(config) @config = config @name = config.fetch(:name) @interval = config.fetch(:interval, '1h') end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
2 3 4 |
# File 'lib/isp_monitor/checks/base_check.rb', line 2 def config @config end |
#interval ⇒ Object (readonly)
Returns the value of attribute interval.
2 3 4 |
# File 'lib/isp_monitor/checks/base_check.rb', line 2 def interval @interval end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
2 3 4 |
# File 'lib/isp_monitor/checks/base_check.rb', line 2 def name @name end |
Instance Method Details
#check ⇒ Object
10 11 12 |
# File 'lib/isp_monitor/checks/base_check.rb', line 10 def check raise NotImplementedError end |
#run ⇒ Object
14 15 16 17 18 19 |
# File 'lib/isp_monitor/checks/base_check.rb', line 14 def run check rescue StandardError => e puts e.inspect puts e.backtrace end |