Sha256: 01c516375837c3d31cbd2a75b3c1823cd95eeb472e735a3c32c539a68f2e10b8

Contents?: true

Size: 467 Bytes

Versions: 1

Compression:

Stored size: 467 Bytes

Contents

module Easymon
  class ActiveRecordCheck
    attr_accessor :klass
    
    def initialize(klass)
      self.klass = klass
    end 
    
    def check
      check_status = database_up?
      if check_status
        message = "Up"
      else
        message = "Down"
      end
      [check_status, message]
    end
    
    private
      def database_up?
        klass.connection.connect!
        klass.connection.active?
      rescue
        false
      end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
easymon-1.6.3 lib/easymon/checks/active_record_check.rb