Class: Econfig::YAML

Inherits:
Object
  • Object
show all
Defined in:
lib/econfig/yaml.rb

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ YAML

Returns a new instance of YAML.



3
4
5
# File 'lib/econfig/yaml.rb', line 3

def initialize(path)
  @path = path
end

Instance Method Details

#get(key) ⇒ Object



7
8
9
# File 'lib/econfig/yaml.rb', line 7

def get(key)
  options[key]
end

#initObject



11
12
13
14
15
16
17
18
19
# File 'lib/econfig/yaml.rb', line 11

def init
  require "yaml"
  require "erb"
  if File.exist?(path)
    @options = ::YAML.load(::ERB.new(File.read(path)).result)[Econfig.env]
  else
    @options = {}
  end
end