On Thu, Mar 29, 2012 at 14:39, Alex Young <alex / blackkettle.org> wrote:

> Would you argue that this is wrong and should be removed?
>
> 1.9.3p125 :001 > nil.to_a
>  => []
>
> If not, why not?
>

Perhaps I wasn't clear (including to myself).

I think nil.to_h is probably fine, for the same reason nil.to_a is fine,
and it would nice to have it. But, I think adding #each to NilClass is the
wrong way to go to get around being able to call #each on the return value
of some method call. If you really need to_h behaviour, I think you can go
for || before sticking #each on NilClass.