------ art_32150_5457778.1149443739305
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
My solution was very simple:
require 'yaml';require 'ostruct';def h(h)h.map{|k,v|h[k]
sh\
v ?h(v):v};OpenStruct.new(h)end;puts h(YAML.load($<.read))
This can't deal with the recursion that MentalGuy(sorry for the wrong
capitalisation!) posted.
The following is basically the same code:
class Hash
def to_ostruct
copy }
each do |(key,value)|
if value.class Hash
copy[key] alue.to_ostruct
else
copy[key] alue
end
end
OpenStruct.new(copy)
end
end
I tried to look into changing YAML.load to make OpenStruct's instead of
hashes, but I soon gave up on that :)
j`ey
------ art_32150_5457778.1149443739305--