lib/fig_newton/missing.rb in fig_newton-0.3 vs lib/fig_newton/missing.rb in fig_newton-0.4
- old
+ new
@@ -1,16 +1,17 @@
module FigNewton
module Missing
def method_missing(*args, &block)
- read_env_file unless @yml
+ read_file unless @yml
m = args.first
value = @yml[m.to_s]
super unless value
value = FigNewton::Node.new(value) unless value.kind_of? String
value
end
- def read_env_file
- @yml = YAML.load_file "#{@yml_directory}/#{ENV['FIG_NEWTON_FILE']}"
+ def read_file
+ @yml = YAML.load_file "#{@yml_directory}/#{ENV['FIG_NEWTON_FILE']}" if ENV['FIG_NEWTON_FILE']
+ FigNewton.load('default.yml') unless ENV['FIG_NEWTON_FILE']
end
end
end