module GClouder::ConfigLoader
Public Class Methods
load(path)
click to toggle source
# File lib/gclouder/config_loader.rb, line 5 def self.load(path) data = DeepMergeHash.new file = File.join(File.dirname(__FILE__), path, "**/*.yml") configs = Dir.glob(file) configs.each do |config| yaml = YAML.load_file config section_path = to_path(config, path) hash = section_path.reverse.inject(yaml) { |value, key| { key => value } } data = data.deep_merge hash end data end
to_path(config, path)
click to toggle source
# File lib/gclouder/config_loader.rb, line 21 def self.to_path(config, path) config.gsub(/.*#{path}\//, "").gsub!(/\.yml$/, "").split("/") end