Class: Peatio::Sql::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/peatio/sql/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeClient

Returns a new instance of Client.


5
6
7
8
9
10
11
12
13
# File 'lib/peatio/sql/client.rb', line 5

def initialize
  @config = {
    host: ENV["DATABASE_HOST"] || "localhost",
    username: ENV["DATABASE_USER"] || "root",
    password: ENV["DATABASE_PASS"] || "",
    port: ENV["DATABASE_PORT"] || "3306",
    database: ENV["DATABASE_NAME"] || "peatio_development",
  }
end

Instance Attribute Details

#clientObject

Returns the value of attribute client


3
4
5
# File 'lib/peatio/sql/client.rb', line 3

def client
  @client
end

#configObject

Returns the value of attribute config


3
4
5
# File 'lib/peatio/sql/client.rb', line 3

def config
  @config
end

Instance Method Details

#connectObject


15
16
17
# File 'lib/peatio/sql/client.rb', line 15

def connect
  @client = Mysql2::Client.new(config)
end