Sha256: 78dda4f247c36885d67a7feaafd65d7c80e8b7bf341b63980a53d906aae03358
Contents?: true
Size: 1.07 KB
Versions: 51
Compression:
Stored size: 1.07 KB
Contents
require 'erb' require 'yaml' require 'rubypitaya/core/path' module RubyPitaya class DatabaseConfig def initialize(environment_name, database_config_path) @environment_name = environment_name yaml_contents = File.open(database_config_path).read @config = YAML.load( ERB.new(yaml_contents).result ) end def config @config[@environment_name] end def connection_data { 'adapter': config['adapter'], 'encoding': config['encoding'], 'pool': config['pool'], 'host': config['host'], 'user': config['user'], 'password': config['password'], 'database': config['database'], } end def connection_data_without_database { 'adapter': config['adapter'], 'encoding': config['encoding'], 'pool': config['pool'], 'host': config['host'], 'user': config['user'], 'password': config['password'], } end def database_name config['database'] end def migrations_path @migrations_path end end end
Version data entries
51 entries across 51 versions & 1 rubygems