Class: HealthMonitor::Providers::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/health_monitor/providers/base.rb

Direct Known Subclasses

Cache, Database, DelayedJob, Redis, Resque, Sidekiq

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#configurationObject

Returns the value of attribute configuration.



7
8
9
# File 'lib/health_monitor/providers/base.rb', line 7

def configuration
  @configuration
end

#requestObject (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

Returns:

  • (Boolean)


34
35
36
# File 'lib/health_monitor/providers/base.rb', line 34

def self.configurable?
  configuration_class
end

.configuration_classObject

This method is abstract.


39
# File 'lib/health_monitor/providers/base.rb', line 39

def self.configuration_class; end

.configure {|@global_configuration| ... } ⇒ Object

Yields:

  • (@global_configuration)


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_nameObject



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.

Raises:

  • (NotImplementedError)


30
31
32
# File 'lib/health_monitor/providers/base.rb', line 30

def check!
  raise NotImplementedError
end