> More than a few times I've wished I could get a nice nested OpenStruct out of
> YAML data, instead of the more unwieldy nested hashes. It's mostly a matter of
> style. It's a straightforward task to convert a nested hash structure into a
> nested OpenStruct, but it's the sort of task that you can do a lot of ways, and
> I'll bet some of you can come up with more elegant and/or more efficient ways
> than I have so far.

This one's a bit of a duck:

class Hash
  def method_missing(mn,*a)
    mn = mn.to_s
    if mn =~ /=$/
      super if a.size > 1
      self[mn[0...-1]] = a[0]
    else
      super unless has_key?(mn) and a.empty?
      self[mn]
    end
  end
end


--
Ilmari