From: Brian Candler Date: 2010-07-07T22:16:58+09:00 Subject: Re: Ruby switches user = Object.new def user.banned?; false; end def user.activated?; true; end # Example 3 class Pred def initialize(sym) @sym = sym end def ===(other) other.send(@sym) end end def is(sym); Pred.new(sym); end Banned = is(:banned?) Activated = is(:activated?) case user when Banned; puts "Banned!" when Activated; puts "Activated!" end -- Posted via http://www.ruby-forum.com/.