Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: a66039d692
Fetching contributors…

Cannot retrieve contributors at this time

33 lines (29 sloc) 0.878 kb
require 'yaml'
module FigNewton
module Missing
def method_missing(*args, &block)
read_file unless @yml
m = args.first
value = @yml[m.to_s]
value = args[1] unless value
value = block.call(m.to_s) unless value or block.nil?
super unless value
value = FigNewton::Node.new(value) unless type_known? value
value
end
def read_file
@yml = nil
@yml = YAML.load_file "#{yml_directory}/#{ENV['FIG_NEWTON_FILE']}" if ENV['FIG_NEWTON_FILE']
hostname = Socket.gethostname
puts hostname
hostfile = "#{yml_directory}/#{hostname}.yml"
puts hostfile
@yml = YAML.load_file hostfile if File.exist? hostfile and @yml.nil?
FigNewton.load('default.yml') if @yml.nil?
end
private
def type_known?(value)
value.kind_of? String or value.kind_of? Integer
end
end
end
Jump to Line
Something went wrong with that request. Please try again.