Forum: Ruby Re: How to find out object type

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
555c1193071e97926fa67c038244c047?d=identicon&s=25 Phy Prabab (Guest)
on 2007-02-20 06:34
(Received via mailing list)
Ah, that's the ticket!  Great thanks for the explanation!

----- Original Message ----
From: Gary Wright <>
To: ruby-talk ML <>
Sent: Monday, February 19, 2007 9:11:45 PM
Subject: Re: How to find out object type

On Feb 20, 2007, at 12:01 AM, Phy Prabab wrote:

> ah, thats better.  So now for the real nubie question, I am lost as
> to why this does not work:
> irb(main):001:0> o = 123
> => 123
> irb(main):002:0> #{o} =
> irb(main):003:0* o.class
> => Fixnum
> irb(main):004:0> #{o}.class

The #{} notation is only applicable inside a string:  "#{o}".  The
way you are using it make the line look like a comment.
Everything after the # is simply discarded.

Maybe you are looking for something like:

a = 123
b = [o]
p b        # [123]

Gary Wright
This topic is locked and can not be replied to.