Sha256: a8129fec5804612fe3cdac5bc6cf38fc91920b63c40a24cb6a93c4f5a92694bd

Contents?: true

Size: 425 Bytes

Versions: 5

Compression:

Stored size: 425 Bytes

Contents

require 'mysql2'

module Caramelize
  module DatabaseConnector

    def database
      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)  }
      @options[:socket] = socket
      @client = Mysql2::Client.new(@options) unless @client
      @client
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
caramelize-1.1.1 lib/caramelize/database_connector.rb
caramelize-1.1.0 lib/caramelize/database_connector.rb
caramelize-1.0.0 lib/caramelize/database_connector.rb
caramelize-0.4.0 lib/caramelize/database_connector.rb
caramelize-0.3.0 lib/caramelize/database_connector.rb