Class: Athar::Dashboard::ConnectionInfo
- Inherits:
-
Object
- Object
- Athar::Dashboard::ConnectionInfo
- Defined in:
- lib/athar/dashboard/connection_info.rb
Overview
Database name + Postgres major version, rendered in the topbar.
Instance Attribute Summary collapse
-
#database ⇒ Object
readonly
Returns the value of attribute database.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(database:, version:) ⇒ ConnectionInfo
constructor
A new instance of ConnectionInfo.
Constructor Details
#initialize(database:, version:) ⇒ ConnectionInfo
Returns a new instance of ConnectionInfo.
14 15 16 17 18 19 |
# File 'lib/athar/dashboard/connection_info.rb', line 14 def initialize(database:, version:) @database = database @version = version freeze end |
Instance Attribute Details
#database ⇒ Object (readonly)
Returns the value of attribute database.
7 8 9 |
# File 'lib/athar/dashboard/connection_info.rb', line 7 def database @database end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
7 8 9 |
# File 'lib/athar/dashboard/connection_info.rb', line 7 def version @version end |
Class Method Details
.fetch ⇒ Object
9 10 11 12 |
# File 'lib/athar/dashboard/connection_info.rb', line 9 def self.fetch version_num = Athar.audit_connection.select_value("SHOW server_version_num").to_i new(database: Athar.audit_db_config.database.to_s, version: "pg#{version_num / 10_000}") end |