From: matz@...
Date: 2016-12-28T04:05:18+00:00
Subject: [ruby-dev:49926] [Ruby trunk Feature#13067] TrueClass, FalseClass to provide `===` to match truthy/falsy values.

Issue #13067 has been updated by Yukihiro Matsumoto.


Nobu, I think the benefit outpass the drawbacks.

Regarding your patch, I think `===` should be its own RDoc entries.

Matz.


----------------------------------------
Feature #13067: TrueClass,FalseClass to provide `===` to match truthy/falsy values.
https://bugs.ruby-lang.org/issues/13067#change-62299

* Author: Yukihiro Matsumoto
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
I propose to make `TrueClass`, `FalseClass` to provide `===` method to match truthy values (`TrueClass`), and falsy values (`FalseClass`), so that we can use true and false for case pattern matching.  And we can pick truthy values using `grep` e.g. `ary.grep(true)`.

Matz.



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