From: Martin DeMello Date: 2010-07-07T23:18:34+09:00 Subject: Re: Ruby switches On Wed, Jul 7, 2010 at 6:23 PM, Kenneth wrote: > I was hoping there would be something like > case user > when banned?    then ... > when activated? then ... > end > > I would like to see something like this but it seems hard to implement. class User attr_accessor :banned def banned? banned end def active? not banned end end class Symbol def ===(other) other.send(self) end end a = User.new a.banned = true case a when :banned? ; puts "banned!" when :active? ; puts "active!" end a.banned = false case a when :banned? ; puts "banned!" when :active? ; puts "active!" end martin