From df0d4200cbfa58f4836b67a173a8745f27b2ffd5 Mon Sep 17 00:00:00 2001 From: Daniel Luz Date: Sat, 7 Jun 2008 02:18:34 -0300 Subject: [PATCH] Coerce elements which respond to #to_ary for Array#flatten --- kernel/core/array.rb | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/core/array.rb b/kernel/core/array.rb index e0addda..bec0953 100644 --- a/kernel/core/array.rb +++ b/kernel/core/array.rb @@ -1662,9 +1662,10 @@ class Array ret = nil array.each { |o| - if o.kind_of? Array + if o.respond_to? :to_ary RecursionGuard.inspect(array) do - recursively_flatten(o, out, recursive_placeholder) + ary = Type.coerce_to o, Array, :to_ary + recursively_flatten(ary, out, recursive_placeholder) ret = self end else -- 1.5.4.3