On 11 Sep 2003 22:10:37 -0700
RLMuller / comcast.net (Richard) wrote:

> Thanks, Michael.
> 
> Obviously, I didn't look at my structure very carefully.  Thanks for
> prodding me in the right direction.  Just in case your interested in
> this trivial function, here's what I wound up with:
> 
> def getTypeOf(o)
>         aTypes = [Array, String, Numeric, Fixnum, Struct, MatchData]
>         result = Object.to_s
>         i = 0
>         for t in aTypes
>             i += 1
>             if o.is_a?t then 
>                 result=t.to_s
>                 break
>             end
>         end
>         result
> end

Why go to all this trouble when you can just do "obj.class.to_s"?

Jason Creighton