From: erikecoologic@... Date: 2019-02-15T03:46:01+00:00 Subject: [ruby-core:91554] [Ruby trunk Feature#9123] Make Numeric#nonzero? behavior consistent with Numeric#zero? Issue #9123 has been updated by ecoologic (erik trapin). I also find this inconsistency very weird and I find ana06's suggestion very good, which I'd expand with: * Deprecate `nonzero?` * A new method `non_zero` returning `self : nil`: Methods ending in `?` should consistently return only `true : false`, maybe `nil` ---------------------------------------- Feature #9123: Make Numeric#nonzero? behavior consistent with Numeric#zero? https://bugs.ruby-lang.org/issues/9123#change-76817 * Author: sferik (Erik Michaels-Ober) * Status: Open * Priority: Normal * Assignee: matz (Yukihiro Matsumoto) * 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 -- https://bugs.ruby-lang.org/ Unsubscribe: