Class: Sequelizer::YamlConfig
- Inherits:
-
Object
- Object
- Sequelizer::YamlConfig
- Defined in:
- lib/sequelizer/yaml_config.rb
Instance Method Summary collapse
-
#environment ⇒ Object
The environment to load from database.yml.
-
#options ⇒ Object
Returns a set of options pulled from config/database.yml or
nil
if config/database.yml doesn’t exist.
Instance Method Details
#environment ⇒ Object
The environment to load from database.yml
Searches the following environment variables in this order:
-
SEQUELIZER_ENV
-
RAILS_ENV
-
RACK_ENV
Lastly, if none of those environment variables are specified, the environment defaults to ‘development’
21 22 23 |
# File 'lib/sequelizer/yaml_config.rb', line 21 def environment ENV['SEQUELIZER_ENV'] || ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development' end |
#options ⇒ Object
Returns a set of options pulled from config/database.yml or nil
if config/database.yml doesn’t exist
7 8 9 10 |
# File 'lib/sequelizer/yaml_config.rb', line 7 def return nil unless config_file.exist? config['adapter'] ? config : config[environment] end |