From: "trans (Thomas Sawyer)" Date: 2013-02-28T22:09:12+09:00 Subject: [ruby-core:53035] [ruby-trunk - Feature #7986][Open] Custom case statement comparison method Issue #7986 has been reported by trans (Thomas Sawyer). ---------------------------------------- Feature #7986: Custom case statement comparison method https://bugs.ruby-lang.org/issues/7986 Author: trans (Thomas Sawyer) Status: Open Priority: Normal Assignee: Category: core Target version: Next Major =begin Case statements use #=== to handle matching, but sometimes this can be limiting. It such cases it would be helpful to be able to specify the comparison method. So I wondered if that could be done by hanging the method off the `case` keyword, e.g. class Bar < Foo; end case == obj.class when Foo p "Foo, not Bar!" when Bar p "Bar!" end And case.include? name when a p "a includes name" when b p "b includes name, not a" else p "neither a or b includes name" end =end -- http://bugs.ruby-lang.org/