Class: Filbert::DbConfig
- Inherits:
-
Object
- Object
- Filbert::DbConfig
- Defined in:
- lib/filbert/db_config.rb
Instance Method Summary collapse
- #config ⇒ Object
- #database ⇒ Object
-
#initialize(config_path, env) ⇒ DbConfig
constructor
A new instance of DbConfig.
- #password ⇒ Object
- #username ⇒ Object
Constructor Details
#initialize(config_path, env) ⇒ DbConfig
Returns a new instance of DbConfig.
4 5 6 7 |
# File 'lib/filbert/db_config.rb', line 4 def initialize(config_path, env) @config_path = config_path @env = env || ENV['RAILS_ENV'] || 'development' end |
Instance Method Details
#config ⇒ Object
21 22 23 |
# File 'lib/filbert/db_config.rb', line 21 def config @config ||= YAML.load_file(@config_path)[@env] end |
#database ⇒ Object
13 14 15 |
# File 'lib/filbert/db_config.rb', line 13 def database config['database'] end |
#password ⇒ Object
17 18 19 |
# File 'lib/filbert/db_config.rb', line 17 def password config['password'] end |
#username ⇒ Object
9 10 11 |
# File 'lib/filbert/db_config.rb', line 9 def username config['username'] end |