Joey wrote:
> The following is basically the same code:
> class Hash
>  def to_ostruct
>    copy = {}
>    each do |(key,value)|
>      if value.class == Hash
>        copy[key] = value.to_ostruct
>      else
>        copy[key] = value
>      end
>    end
>    OpenStruct.new(copy)
>  end
> end

This would be cleaner

   class Hash
     def to_ostruct
       copy = dup
       copy.each do |key, value|
         copy[key] = value.to_ostruct if value.respond_to? :to_ostruct
       end
       return copy
     end
   end


Daniel