public
Description: Rubinius, the Ruby VM
Homepage: http://rubini.us
Clone URL: git://github.com/evanphx/rubinius.git
Coerce elements which respond to #to_ary for Array#flatten

Signed-off-by: Brian Ford <bford@engineyard.com>
mernen (author)
Fri Jun 06 22:18:34 -0700 2008
Brian Ford (committer)
Sun Jun 08 14:02:37 -0700 2008
commit  31a3a966a681e46a4918a12641b9a2bb4b59cb0b
tree    4eca6d4b5634237546189a28c344a9b59c4fe05a
parent  614d3e32f4559bfada406223f681b902da13cbfd
...
1662
1663
1664
1665
 
1666
1667
 
 
1668
1669
1670
...
1662
1663
1664
 
1665
1666
 
1667
1668
1669
1670
1671
0
@@ -1662,9 +1662,10 @@ class Array
0
 
0
     ret = nil
0
     array.each { |o|
0
-      if o.kind_of? Array
0
+      if o.respond_to? :to_ary
0
         RecursionGuard.inspect(array) do
0
-          recursively_flatten(o, out, recursive_placeholder)
0
+          ary = Type.coerce_to o, Array, :to_ary
0
+          recursively_flatten(ary, out, recursive_placeholder)
0
           ret = self
0
         end
0
       else

Comments