From: "rosenfeld (Rodrigo Rosenfeld Rosas)" Date: 2013-11-28T21:05:19+09:00 Subject: [ruby-core:58659] [ruby-trunk - Feature #9123] Make Numeric#nonzero? behavior consistent with Numeric#zero? Issue #9123 has been updated by rosenfeld (Rodrigo Rosenfeld Rosas). Now I finally understand the purpose of nonzero? :) In several languages, including Perl and JavaScript, 0 is a falsy value, but this is not the case for Ruby. So it's kind of a hack to make 0 be treated as a falsy value :) Indeed, now that I understand it, I could find quite some usage for it :) ---------------------------------------- Feature #9123: Make Numeric#nonzero? behavior consistent with Numeric#zero? https://bugs.ruby-lang.org/issues/9123#change-43226 Author: sferik (Erik Michaels-Ober) Status: Open Priority: Normal Assignee: Category: 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/