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 Blumenfeld
on 2011-06-14 05:31
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.