Class: Makanai::Database

Inherits:
Object
  • Object
show all
Defined in:
lib/makanai/database.rb

Defined Under Namespace

Classes: UnsupportedException

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#clientObject (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