module DashingStorage

Constants

VERSION

Public Class Methods

db() click to toggle source
# File lib/dashing_storage.rb, line 7
def self.db
  return @db if @db
  @db = connection.db(config['database'])
  @db.authenticate(config['user'], config['password']) unless (config['user'].nil? || config['user'].empty?)
  @db
end

Private Class Methods

config() click to toggle source
# File lib/dashing_storage.rb, line 20
def self.config
  yml = YAML.load_file('database.yml')
  yml[env]
end
connection() click to toggle source
# File lib/dashing_storage.rb, line 16
def self.connection
  @connection ||= Mongo::Connection.new(config['host1'], config['port1'])
end
env() click to toggle source
# File lib/dashing_storage.rb, line 25
def self.env
  Sinatra::Application.environment.to_s
end