Class: Hcheck::Configuration::Service
- Defined in:
- lib/hcheck/configuration/service.rb
Overview
Main service class One to one servcie class is created from hcheck.yml top level keys includes corresponsing check module; which includes status method
Constant Summary collapse
- NOT_IMPLEMENTED_MSG =
'Check not implemented for this service'
Instance Attribute Summary collapse
-
#check_not_available ⇒ Object
readonly
Returns the value of attribute check_not_available.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #check ⇒ Object
-
#initialize(service, options) ⇒ Service
constructor
A new instance of Service.
Constructor Details
#initialize(service, options) ⇒ Service
Returns a new instance of Service.
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/hcheck/configuration/service.rb', line 18 def initialize(service, ) @name = service.to_s @check = .delete('check') @options = .symbolize_keys if mod = load_mod singleton_class.send(:include, mod) else @check_not_available = true end end |
Instance Attribute Details
#check_not_available ⇒ Object (readonly)
Returns the value of attribute check_not_available.
14 15 16 |
# File 'lib/hcheck/configuration/service.rb', line 14 def check_not_available @check_not_available end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
14 15 16 |
# File 'lib/hcheck/configuration/service.rb', line 14 def name @name end |
Instance Method Details
#check ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/hcheck/configuration/service.rb', line 29 def check { name: @name, desc: @check, status: @check_not_available ? NOT_IMPLEMENTED_MSG : check_status } end |