lib/fig_newton/missing.rb in fig_newton-0.15 vs lib/fig_newton/missing.rb in fig_newton-1.0
- old
+ new
@@ -1,7 +1,8 @@
require 'yaml'
require 'socket'
+require 'erb'
module FigNewton
module Missing
def method_missing(*args, &block)
read_file unless @yml
@@ -14,10 +15,10 @@
value
end
def read_file
@yml = nil
- @yml = YAML.load_file "#{yml_directory}/#{ENV['FIG_NEWTON_FILE']}" if ENV['FIG_NEWTON_FILE']
+ @yml = ::YAML.load(ERB.new(File.read("#{yml_directory}/#{ENV['FIG_NEWTON_FILE']}")).result(binding)) if ENV['FIG_NEWTON_FILE']
unless @yml
hostname = Socket.gethostname
hostfile = "#{yml_directory}/#{hostname}.yml"
@yml = YAML.load_file hostfile if File.exist? hostfile
end