The following code should work:
class Foo
def method_missing(name, *args)
[]
end
end
fail unless [] == Array(Foo.new)
The existing logic (possibly from 1.8) does not follow the method_missing path. If there's no to_ary or to_a, the object is just wrapped in an array.
This is the cause of the first bunch of errors in this Travis CI job (thanks @rkh): https://travis-ci.org/travis-ci/travis-yaml/builds/34826144