Class: HealthMonitor::Providers::Base
- Inherits:
-
Object
- Object
- HealthMonitor::Providers::Base
- Defined in:
- lib/health_monitor/providers/base.rb
Instance Attribute Summary collapse
-
#configuration ⇒ Object
Returns the value of attribute configuration.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Class Method Summary collapse
- .configurable? ⇒ Boolean
- .configuration_class ⇒ Object abstract
- .configure {|@global_configuration| ... } ⇒ Object
- .provider_name ⇒ Object
Instance Method Summary collapse
- #check! ⇒ Object abstract
-
#initialize(request: nil) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(request: nil) ⇒ Base
Returns a new instance of Base.
21 22 23 24 25 26 27 |
# File 'lib/health_monitor/providers/base.rb', line 21 def initialize(request: nil) @request = request return unless self.class.configurable? self.configuration = self.class.instance_variable_get('@global_configuration') end |
Instance Attribute Details
#configuration ⇒ Object
Returns the value of attribute configuration.
7 8 9 |
# File 'lib/health_monitor/providers/base.rb', line 7 def configuration @configuration end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
6 7 8 |
# File 'lib/health_monitor/providers/base.rb', line 6 def request @request end |
Class Method Details
.configurable? ⇒ Boolean
34 35 36 |
# File 'lib/health_monitor/providers/base.rb', line 34 def self.configurable? configuration_class end |
.configuration_class ⇒ Object
This method is abstract.
39 |
# File 'lib/health_monitor/providers/base.rb', line 39 def self.configuration_class; end |
.configure {|@global_configuration| ... } ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/health_monitor/providers/base.rb', line 13 def self.configure return unless configurable? @global_configuration = configuration_class.new yield @global_configuration if block_given? end |
.provider_name ⇒ Object
9 10 11 |
# File 'lib/health_monitor/providers/base.rb', line 9 def self.provider_name @provider_name ||= name.demodulize end |
Instance Method Details
#check! ⇒ Object
This method is abstract.
30 31 32 |
# File 'lib/health_monitor/providers/base.rb', line 30 def check! raise NotImplementedError end |