From: matz@... Date: 2017-08-31T05:41:23+00:00 Subject: [ruby-core:82547] [Ruby trunk Feature#13395] Add a method to check for not nil Issue #13395 has been updated by matz (Yukihiro Matsumoto). Your example is bit weak. Is there any **realistic** use-case for the method? Matz. ---------------------------------------- Feature #13395: Add a method to check for not nil https://bugs.ruby-lang.org/issues/13395#change-66355 * Author: JustJosh (Joshua Stowers) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- There does not seem to be a method in Ruby to check if an object is *not* nil. Such a method could help with readability. Example: > ~~~ ruby > array = [1, 'dog', nil] > array.count(&:not_nil?) > ~~~ > vs > ~~~ ruby > array = [1, 'dog', nil] > array.reject(&:nil?).count > ~~~ -- https://bugs.ruby-lang.org/ Unsubscribe: