From: Daniel DeLorme Date: 2006-08-09T12:13:19+09:00 Subject: Re: For Float#class why is '===' different from '==' richB wrote: > I appreciate the responses. I'm still puzzled. It seems that "case a" > is different from "case a.class" and that the comparison being done by > "===" in when is influenced by the type/class of the when operand. Like most operators, === is just a method call. The following are equivalent: case a when b and if b === a Therefore the behavior of === depends on b. If b is a Class (e.g. Float), it's equivalent to a.is_a?(b). If b is a Float (e.g. 2.3), it's equivalent to b == a. I usually view the === operator as the inclusion operator: b === a -> does b include a? which brings me to... would there be any nasty side-effects to this? class Object def ===(other) if respond_to?(:include) self == other or include?(other) else self == other end end end Daniel