--0-1850199232-11719486059889
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

But that then would assume I know what the object might be.  I mean, do I really test for all primitive object types?  Someone else sent the <obj>.class which will give a "hint" as to the class the object was created with.  This seems to fit what I was looking for.

Many thanks to all!
Phy

----- Original Message ----
From: Daniel N <has.sox / gmail.com>
To: ruby-talk ML <ruby-talk / ruby-lang.org>
Sent: Monday, February 19, 2007 9:01:44 PM
Subject: Re: How to find out object type

On 2/20/07, Phy Prabab <phyprabab / yahoo.com> wrote:
>
> umm, perhaps I am doing something wrong:
>
> irb(main):005:0> o.kind_of(0)
> NoMethodError: undefined method `kind_of' for 123:Fixnum
>         from (irb):5
> irb(main):006:0> o.kind_of(1)
> NoMethodError: undefined method `kind_of' for 123:Fixnum
>         from (irb):6
> irb(main):007:0>


methods may have punctuation in ruby.  kind_of?( OBJECT ) uses a question
mark.

It makest into a question.  Effectively what happens as I understand it is
you ask the object what kind of object are you?

eg

o.kind_of?( Fixnum







 
____________________________________________________________________________________
Sucker-punch spam with award-winning protection. 
Try the free Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/features_spam.html
--0-1850199232-11719486059889--