Class: StatusCat::Checkers::ActiveRecord
- Inherits:
-
Base
- Object
- Base
- StatusCat::Checkers::ActiveRecord
show all
- Defined in:
- lib/status_cat/checkers/active_record.rb
Constant Summary
Constants inherited
from Base
Base::FORMAT
Instance Attribute Summary
Attributes inherited from Base
#status, #value
Instance Method Summary
collapse
Methods inherited from Base
class_to_name, #name, #to_s
Constructor Details
Returns a new instance of ActiveRecord.
5
6
7
8
|
# File 'lib/status_cat/checkers/active_record.rb', line 5
def initialize
@value = "#{adapter}:#{username}@#{database}"
@status = fail_on_exception { test }
end
|
Instance Method Details
#adapter ⇒ Object
19
20
21
|
# File 'lib/status_cat/checkers/active_record.rb', line 19
def adapter
return config[:adapter]
end
|
#config ⇒ Object
15
16
17
|
# File 'lib/status_cat/checkers/active_record.rb', line 15
def config
return ::ActiveRecord::Base.connection_config
end
|
#database ⇒ Object
23
24
25
|
# File 'lib/status_cat/checkers/active_record.rb', line 23
def database
return config[:database]
end
|
#test ⇒ Object
10
11
12
13
|
# File 'lib/status_cat/checkers/active_record.rb', line 10
def test
::ActiveRecord::Base.connection.execute('select max(version) from schema_migrations')
return nil
end
|
#username ⇒ Object
27
28
29
|
# File 'lib/status_cat/checkers/active_record.rb', line 27
def username
return config[:username]
end
|