On Thu, Aug 4, 2011 at 11:37 PM, Ryan Davis <ryand-ruby / zenspider.com>wrote:
>
> Extra Info:
> http://tenderlovemaking.com/2011/06/28/til-its-ok-to-return-nil-from-to_ary/
>

Someone made a comment on that post linking to
http://yehudakatz.com/2010/01/02/the-craziest-fing-bug-ive-ever-seen/ which
explains, specifically for Array#flatten:

----

In Ruby 1.8, the process is essentially the following:

if obj.respond_to?(:to_ary)
  obj.__send__(:to_ary)
else
  obj
end

In Ruby 1.9, it was changed to:

begin
  obj.__send__(:to_ary)
rescue NoMethodError
  obj
end

----

I'm not sure why that changed happened, but at least that seems to be the
source of the behaviour.