From: Daniel Schierbeck Date: 2006-07-29T06:10:06+09:00 Subject: Re: Weird problem with case expressions On a side note, this could be interesting: class Object def types methods.grep(/^to_/).map{|type| type[3..-1].to_sym} end end "foo".types #=> [:a, :sym, :s, :i, :f, :str] and maybe also class Object def of_type?(type) respond_to? "to_#{type}" end end foo(obj) if obj.of_type? :bar Though of course it's just an easier way to use #respond_to? Cheers, Daniel