Sha256: 0055cec20749178844a6fabebe60bc5ff664edf441b0cadf3ff569f49648bc37

Contents?: true

Size: 505 Bytes

Versions: 4

Compression:

Stored size: 505 Bytes

Contents

# frozen_string_literal: true

require 'mysql2'

module Caramelize
  module DatabaseConnector
    def database
      @options[:socket] = ['/tmp/mysqld.sock',
                           '/tmp/mysql.sock',
                           '/var/run/mysqld/mysqld.sock',
                           '/opt/local/var/run/mysql5/mysqld.sock',
                           '/var/lib/mysql/mysql.sock'].detect { |socket| File.exist?(socket) }
      @client ||= Mysql2::Client.new(@options)
      @client
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
caramelize-1.3.1 lib/caramelize/database_connector.rb
caramelize-1.3.0 lib/caramelize/database_connector.rb
caramelize-1.2.1 lib/caramelize/database_connector.rb
caramelize-1.2.0 lib/caramelize/database_connector.rb