Class: Rx::Check::ActiveRecordCheck

Inherits:
Object
  • Object
show all
Defined in:
lib/rx/check/active_record_check.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = "activerecord") ⇒ ActiveRecordCheck

Returns a new instance of ActiveRecordCheck.



6
7
8
# File 'lib/rx/check/active_record_check.rb', line 6

def initialize(name = "activerecord")
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/rx/check/active_record_check.rb', line 4

def name
  @name
end

Instance Method Details

#checkObject



10
11
12
13
14
15
16
17
18
# File 'lib/rx/check/active_record_check.rb', line 10

def check
  Result.from(name) do
    unless activerecord_defined?
      raise StandardError.new("Undefined class ActiveRecord::Base")
    end

    ActiveRecord::Base.connection.active?
  end
end