Open YannIsCoding opened 1 year ago
Kernel#Array returns an empty array when given nil. However, nil is retained when given an array containing nil. Unfortunately, this somehow surprising behavior is not documented.
Kernel#Array
nil
Array(nil) # => [] Array([nil]) # => [nil]
Shall I open a PR to remedy this? :)
Hi @YannIsCoding , [nil].to_a # => [nil]
[nil].to_a # => [nil]
It is not surprising to me. The document is clear to me.
Kernel#Array
returns an empty array when givennil
. However,nil
is retained when given an array containingnil
. Unfortunately, this somehow surprising behavior is not documented.Shall I open a PR to remedy this? :)