[#70843] Re: [ruby-cvs:58952] hsbt:r51801 (trunk): * lib/rubygems: Update to RubyGems HEAD(fe61e4c112). — Eric Wong <normalperson@...>
hsbt@ruby-lang.org wrote:
3 messages
2015/09/17
[ruby-core:70720] [Ruby trunk - Misc #11520] Inconsistent behavior in Array#compact!
From:
postmodern.mod3@...
Date:
2015-09-10 23:49:56 UTC
List:
ruby-core #70720
Issue #11520 has been updated by Hal Brodigan.
Tracker changed from Bug to Misc
Ah, I was unaware that was the intention. I guess I should use `.tap(&:compact!)` instead. This issue can be closed.
----------------------------------------
Misc #11520: Inconsistent behavior in Array#compact!
https://bugs.ruby-lang.org/issues/11520#change-54105
* Author: Hal Brodigan
* Status: Open
* Priority: Normal
* Assignee:
----------------------------------------
I noticed that `Array#compact!` sometimes returns `self` and other times `nil`. This behavior was a bit confusing.
[].compact!
# => nil
[1].compact!
# => nil
[nil].compact!
# => []
[1, nil].compact!
# => [1]
I would prefer that `Array#compact!` either always returns `nil`, or always returns `self`.
--
https://bugs.ruby-lang.org/