[#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:70718] Re: [Ruby trunk - Bug #11520] [Open] Inconsistent behavior in Array#compact!
From:
Steven Nunez <steven.nunez@...>
Date:
2015-09-10 20:00:58 UTC
List:
ruby-core #70718
This is consistent with other mutating methods. >> "Steven".chomp! => nil >> "Steven\n".chomp! => "Steven" _____________________ Steven Nunez steven.nunez@gmail.com @_StevenNunez On Thu, Sep 10, 2015 at 3:43 PM, <postmodern.mod3@gmail.com> wrote: > Issue #11520 has been reported by Hal Brodigan. > > ---------------------------------------- > Bug #11520: Inconsistent behavior in Array#compact! > https://bugs.ruby-lang.org/issues/11520 > > * Author: Hal Brodigan > * Status: Open > * Priority: Normal > * Assignee: > * ruby -v: ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux] > * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN > ---------------------------------------- > 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/ >