hamstergem / hamster

Efficient, Immutable, Thread-Safe Collection classes for Ruby
Other
1.89k stars 94 forks source link

Vector#flatten: correct behaviour when no argument is passed - to support Rubinius and JRuby #156

Closed dubek closed 10 years ago

dubek commented 10 years ago

In case no argument is passed to Vector#flatten, we call Array#flatten(nil); but the correct argument to pass is -1 to indicate endless recursive flatenning.

While MRI accepts both -1 and nil, Rubinius and JRuby don't accept an explicit nil argument to Array#flatten.

With this patch applied the Hamster specs pass on Rubinius 2.3.0 .

See relevant discussion in the Rubinius ticket: https://github.com/rubinius/rubinius/pull/3175

alexdowad commented 10 years ago

Looks good, thank you. Merging.