How to find out object type

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>

···

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

object.kind_of?( Array ) #=> To test if it is something
object.is_a?( Array ) #=> Same

object.class #=> Tells you what class the object thinks it is.

On 2/20/07, Phy Prabab <phyprabab@yahoo.com> wrote:

Hello,

I am curious, is there a way to find out an object type?

TIA,
Phy

____________________________________________________________________________________
Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.
http://autos.yahoo.com/new_cars.html

____________________________________________________________________________________
Never miss an email again!
Yahoo! Toolbar alerts you the instant new Mail arrives.
http://tools.search.yahoo.com/toolbar/features/mail/

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

It makes it 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 )

···

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>