module GlobalSharedDb
Constants
- VERSION
Attributes
db_config[R]
Public Class Methods
env()
click to toggle source
# File lib/global_shared_db.rb, line 18 def env @env ||= ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'development' end
establish_connection(spec)
click to toggle source
# File lib/global_shared_db.rb, line 32 def establish_connection(spec) if defined?(Octopus) GlobalSharedDb::BaseDb.octopus_establish_connection(spec) elsif defined?(DbCharmer) GlobalSharedDb::BaseDb.db_magic :connection => spec else GlobalSharedDb::BaseDb.establish_connection(spec) end end
root()
click to toggle source
# File lib/global_shared_db.rb, line 14 def root @root ||= File.expand_path('../../', __FILE__) end
setup(config)
click to toggle source
# File lib/global_shared_db.rb, line 22 def setup(config) case config when Hash @db_config = config.stringify_keys else raise "Invalid config" end establish_connection(config) end
Private Class Methods
valid_config?(config)
click to toggle source
# File lib/global_shared_db.rb, line 44 def valid_config?(config) config[:adapter] && config[:host] && config[:database] rescue false end