class NetMate::Connection

Attributes

db_config[R]

Public Class Methods

disconnect(dbh) click to toggle source
# File lib/net_mate/connection.rb, line 20
def self.disconnect dbh
  dbh.close if dbh
end
new(path = nil) click to toggle source
# File lib/net_mate/connection.rb, line 9
def initialize path = nil
  path ||= "#{ROOT_PATH}/config/database.yml"
  @db_config = YAML.load_file(path)['development']
rescue
  abort 'Please check if you are in the proper Application directory!'
end

Public Instance Methods

connect() click to toggle source
# File lib/net_mate/connection.rb, line 16
def connect
  Mysql2::Client.new @db_config
end