Issue #12047 has been updated by jonathanhefner (Jonathan Hefner).


This was added in Ruby 2.5, so I think this issue can be closed.


----------------------------------------
Feature #12047: Set#=== (aliased to include?)
https://bugs.ruby-lang.org/issues/12047#change-84181

* Author: Phrogz (Gavin Kistner)
* Status: Open
* Priority: Normal
----------------------------------------
Add `Set#===` as an alias for `Set#include?` so that sets may be used in `case` statements:

~~~
require 'set'
GOOD_COMMANDS = Set[ :foo, :bar, :jim ]
BAD_COMMANDS  = Set[ :baz, :bax, :jam ]
ODD_COMMANDS  = Set[ :quux, :xyzzy ]

case my_command
  when GOOD_COMMANDS then puts "Yay!"
  when BAD_COMMANDS  then puts "Boo!"
  when ODD_COMMANDS  then puts "Whaa?"
end
~~~



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

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>