Hash#flatten not implemented

Hi All,

I just found out that Hash#flatten is not implemented in IronRuby, for
whoever that needs it here is the implementation (I tested it comparing
the results with Ruby 1.9.2) giving the same results:


class Hash
def flatten(level=1)
a = []
self.each{|x,y| a << x; a << y}
while level > 1
a = a.flatten
level -= 1
end
a
end
end

You would need to put it at the very beginning of any application that
needs that standard functionality.

I’m not sure this is the best implementation, but it is quick & dirty
and solved my problems with a gem that used Hash#flatten internally…

Hope IronRuby includes the right implementation (or this one if the
maintainers deem reasonable) in the next IronRuby release.

Best Regards to everyone

Eduardo B.