Re: How to find out object type


#1

Ah, that’s the ticket! Great thanks for the explanation!

----- Original Message ----
From: Gary W. removed_email_address@domain.invalid
To: ruby-talk ML removed_email_address@domain.invalid
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 P. 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} = Array.new
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 W.