Class: Peatio::Sql::Client
- Inherits:
-
Object
- Object
- Peatio::Sql::Client
- Defined in:
- lib/peatio/sql/client.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
-
#config ⇒ Object
Returns the value of attribute config.
Instance Method Summary collapse
- #connect ⇒ Object
-
#initialize ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize ⇒ Client
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
#client ⇒ Object
Returns the value of attribute client.
3 4 5 |
# File 'lib/peatio/sql/client.rb', line 3 def client @client end |
#config ⇒ Object
Returns the value of attribute config.
3 4 5 |
# File 'lib/peatio/sql/client.rb', line 3 def config @config end |
Instance Method Details
#connect ⇒ Object
15 16 17 |
# File 'lib/peatio/sql/client.rb', line 15 def connect @client = Mysql2::Client.new(config) end |