Class: Sequelizer::YamlConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/sequelizer/yaml_config.rb

Instance Method Summary collapse

Instance Method Details

#environmentObject

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

#optionsObject

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 options
  return nil unless config_file.exist?
  config['adapter'] ? config : config[environment]
end