lib/settingslogic.rb in dc-settingslogic-2.1.0 vs lib/settingslogic.rb in dc-settingslogic-2.1.1
- old
+ new
@@ -104,10 +104,11 @@
files = hash_or_file.reject { |file| file.nil? }
files.each do |file|
next unless File.exist? file
file_contents = open(file).read
- single_hash = file_contents.empty? ? {} : YAML.load(ERB.new(file_contents).result).to_hash
+ raw_result = YAML.load(ERB.new(file_contents).result)
+ single_hash = raw_result ? raw_result : {}
hash.merge! single_hash
end
if self.class.namespace
hash = hash[self.class.namespace] or return missing_key("Missing setting '#{self.class.namespace}' in #{files.join(', ')}")
end