Class: Makanai::Database
- Inherits:
-
Object
- Object
- Makanai::Database
- Defined in:
- lib/makanai/database.rb
Defined Under Namespace
Classes: UnsupportedException
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
- #execute_sql(sql) ⇒ Object
-
#initialize(client: Settings.databse_client, config: Settings.databse_config) ⇒ Database
constructor
A new instance of Database.
Constructor Details
#initialize(client: Settings.databse_client, config: Settings.databse_config) ⇒ Database
Returns a new instance of Database.
9 10 11 12 |
# File 'lib/makanai/database.rb', line 9 def initialize(client: Settings.databse_client, config: Settings.databse_config) client_class = client_class(client) @client = client_class.new(config) end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
14 15 16 |
# File 'lib/makanai/database.rb', line 14 def client @client end |
Instance Method Details
#execute_sql(sql) ⇒ Object
16 17 18 19 |
# File 'lib/makanai/database.rb', line 16 def execute_sql(sql) puts "SQL: #{sql.gsub("\n", ' ')}" client.execute_sql(sql) end |