Commit 3f1a3d55 authored by John E. Vincent's avatar John E. Vincent

fix for short-form on 1.8

parent c5141968
...@@ -69,7 +69,17 @@ module Noah ...@@ -69,7 +69,17 @@ module Noah
if short == false if short == false
configs.each {|x| config_hash["#{x.name}"] = x.to_hash.reject {|k,v| k == :name} } configs.each {|x| config_hash["#{x.name}"] = x.to_hash.reject {|k,v| k == :name} }
else else
configs.each {|x| config_hash["#{x.name}"] = x.to_hash.select {|k,v| k if short_keys.include?(k)} } configs.each do |x|
items = x.to_hash.select {|k,v| k if short_keys.include?(k)}
# 1.8 fix for Hash#select
if items.is_a?(Array)
items_hash = {}
items.each {|item| items_hash.merge!(Hash[*item])}
else
items_hash = items
end
config_hash["#{x.name}"] = items_hash
end
end end
config_hash config_hash
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment