I had a similar function when I read a lot of YAML files from the initializer and added to the global variable. it is something like this:
APP = Hash.new
Dir.glob("#{Rails.root}/config/data/*.yml").each do |file|
fdata = File.open(file).read
APP.merge!(YAML::load(ERB.new(fdata).result(binding)).symbolize_keys!)
end
I have to learn more about your problem in order to write a more specific solution.
- YAML:: load, yaml .
ERB , Yaml erb, . .
symbolize_keys! [: ], [ "" ] .