Class: Mysqlman::Connection
- Inherits:
-
Object
- Object
- Mysqlman::Connection
- Includes:
- Singleton
- Defined in:
- lib/mysqlman/connection.rb
Instance Attribute Summary collapse
-
#conn ⇒ Object
Returns the value of attribute conn.
Instance Method Summary collapse
-
#initialize ⇒ Connection
constructor
A new instance of Connection.
- #query(query_string) ⇒ Object
Constructor Details
#initialize ⇒ Connection
Returns a new instance of Connection.
12 13 14 15 16 |
# File 'lib/mysqlman/connection.rb', line 12 def initialize config = YAML.load_file(MANAGER_CONFIG).map { |k, v| [k.to_sym, v] }.to_h config.merge(database: 'mysql') @conn = Mysql2::Client.new(config) end |
Instance Attribute Details
#conn ⇒ Object
Returns the value of attribute conn.
10 11 12 |
# File 'lib/mysqlman/connection.rb', line 10 def conn @conn end |
Instance Method Details
#query(query_string) ⇒ Object
18 19 20 |
# File 'lib/mysqlman/connection.rb', line 18 def query(query_string) @conn.query(query_string) end |