Project

General

Profile

Actions

Feature #12110

open

Create a method to avoid vacuous truth?

Added by rydlaw (Waldyr de Souza) over 5 years ago. Updated over 5 years ago.

Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:73986]

Description

I often find myself running into unexpected results when using #all? for example

[].all? { |e| false } # => true

Even though it's logically correct could we have a method that express the following?

foo.any? && foo.all?(&:bar)
Actions

Also available in: Atom PDF