From: Hal Fulton Date: 2004-10-11T18:47:12+09:00 Subject: Re: [Q] case based on object class George Moschovitis wrote: > Hello everyone, > > I wonder if there is a more elegant/efficient way to rewrite > the case structure in the following code snippet: Certainly... see below. > def myfunc(obj) > case obj > when Fixnum > puts :Fixnum > when Float > puts :Float > ... > default > puts :Object > end > end This works because case invokes ===, which takes a minute or three to understand. :) Hal PS - In my Mozilla, your font is microscopic. :0 H