44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
# File 'lib/bonethug/conf.rb', line 44
def compile_configuration
use_defaults if @paths.empty?
out = {}
@paths.each do |path,options|
load_path path unless @loaded_paths.include? path
fragment_base = {}
if options and options.has_key? :root
fragment = fragment_base
nodes = options[:root].split '.'
nodes.each_with_index do |node,i|
fragment[node] = i == nodes.length-1 ? @config_hashes[path] : {}
fragment = fragment[node]
end
else
fragment_base = @config_hashes[path]
end
out = out.merge fragment_base
end
@compiled_hash = out
self
end
|