Skip to content

Array() does not coerce according to MRI 1.9 logic #1962

@headius

Description

@headius

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions