Module: ErbYaml

Defined in:
lib/erb-yaml.rb,
lib/erb-yaml/version.rb

Constant Summary collapse

VERSION =
"1.0.1"

Class Method Summary collapse

Class Method Details

.load(yaml, env) ⇒ Object



11
12
13
14
15
# File 'lib/erb-yaml.rb', line 11

def self.load(yaml, env)
  hash = YAML.load(yaml)[env.to_s]
  raise "No content at: #{path} for key: #{env}" if hash.nil?
  hash.recursive_symbolize_keys!
end

.read(path, env) ⇒ Object



6
7
8
9
# File 'lib/erb-yaml.rb', line 6

def self.read(path, env)
  yaml = ERB.new(IO.read path).result
  load yaml, env
end