General

Profile

elandesign (Paul Smith)

  • Login: elandesign
  • Registered on: 08/31/2017
  • Last sign in: 08/31/2017

Issues

open closed Total
Assigned issues 0 0 0
Reported issues 0 1 1

Activity

08/31/2017

10:21 PM Ruby Bug #13855: Hash#compact! returns nil if the hash is empty
lucasbuchala (Lucas Buchala) wrote:
> Rather than a bug, I wonder if this is just a documentation omission.
> ...
Oh that's interesting - I hadn't noticed that returning nil if the object was unchanged was the actual behaviour there. I...
elandesign (Paul Smith)
03:24 PM Ruby Bug #13855 (Closed): Hash#compact! returns nil if the hash is empty
This behaviour feels like a bug to me.
From the documentation (with my emphasis):
> compact! → hsh
> ...
However if the hash contains no keys, the method returns nil.
~~~
irb(main):001:0> {}.compact!
=> nil
# For Compariso...
elandesign (Paul Smith)

Also available in: Atom