"baumanj / gmail.com" <baumanj / gmail.com> writes:

> ara.t.howard / noaa.gov wrote:
>> On Fri, 31 Mar 2006, Christian Neukirchen wrote:
>> > if a.kind_of? Boolean
>> >
>> > case y
>> >  when Integer
>> >  when Boolean
>> > end
>
> What kind of scenarios would you want to use such a construct? It seems
> to me not very rubyish to be switching based on the class of an object.
> As I understand it, the more conventional way to deal with potentially
> diverse argument types is to use the respond_to? method. This keeps the
> door open for duck typing.

Except we don't have a to_bool, either ;-).

Still, I can saw enough cases where I wanted such a "case", and
grumbly used TrueClass,FalseClass.

-- 
Christian Neukirchen  <chneukirchen / gmail.com>  http://chneukirchen.org