Class: SlonikMigration::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/slonik_migration/config.rb

Class Method Summary collapse

Class Method Details

.loadObject



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/slonik_migration/config.rb', line 6

def load
  file = config_file
  env = ENV['RAILS_ENV'] || 'development'

  hash = if File.exist?(file)
           YAML.load(ERB.new(IO.read(file)).result)[env]
         else
           {}
         end
  OpenStruct.new(hash).freeze
end