# Re: How to find out object type

**URL:** <https://www.ruby-forum.com/t/re-how-to-find-out-object-type/86139>\
**Category:** Ruby\
**Created:** [February 20, 2007, 6:17am UTC](https://www.ruby-forum.com/t/re-how-to-find-out-object-type/86139 "2007-02-20T06:17:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Phy\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a587f6/32.png) [@Phy\_P](https://www.ruby-forum.com/u/Phy_P)\
**Post date:** [February 20, 2007, 6:17am UTC](https://www.ruby-forum.com/t/re-how-to-find-out-object-type/86139/1 "2007-02-20T06:17:33Z")

</div>

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  
.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 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
To: ruby-talk ML [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Sent: Monday, February 19, 2007 9:01:44 PM  
Subject: Re: How to find out object type

On 2/20/07, Phy P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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 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 )
