Issue #9123 has been updated by avit (Andrew Vit).


> i think that the most useful part of this proposal is deprecating `Numeric#nonzero?` with its current behavior in favour of `Numeric#nonzero`.

Personally I would agree with this too. I guess I'm not a fan of quirks if they're inconsistent... 

* Asking "are you nonzero?" should be true/false (eventually). 
* Saying "give me your nonzero value" should be the number, or nil.

----------------------------------------
Feature #9123: Make Numeric#nonzero? behavior consistent with Numeric#zero?
https://bugs.ruby-lang.org/issues/9123#change-43354

Author: sferik (Erik Michaels-Ober)
Status: Open
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: core
Target version: 


Numeric#zero? returns true or false, while Numeric#nonzero? returns self or nil.

I've written a patch that fixes this inconsistency and adds a Numeric#nonzero (non-predicate) method that returns self or nil for chaining comparisons. I'd like for this to be included in Ruby 2.1.0.

https://github.com/ruby/ruby/pull/452.patch


-- 
http://bugs.ruby-lang.org/