On May 6, 2007, at 6:06 AM, Robert Dober wrote:

> On 5/5/07, John Joyce <dangerwillrobinsondanger / gmail.com> wrote:
>> Suppose I have an object :
>>
>> a = 3
>>
>> I want to output the name a and the contents 3
>> Outputing the contents is no problem.
>> Is  there a method to output the name of the variable (object)
>
> No there is no way to output the name of a variable as a variable is
> one of the view concepts in Ruby that are not directly accessible from
> inside Ruby.
> When it comes to objects things change of course, some objects have
> name properties as e.g. classes
>
> irb(main):002:0> A=Class.new
> => A
> irb(main):003:0> A.name
> => "A"
> But be aware that it is the object and not the constant referring to
> it who has the name, as one can easily see...
> irb(main):007:0* b = Class.new
> => #<Class:0xb7d9ce54>
> irb(main):008:0> b.name
> => ""
> irb(main):009:0> C = b
> => C
> irb(main):010:0> C.name
> => "C"
> irb(main):011:0> b.name
> => "C"
>
> this is maybe a little bit confusing but that is what ruby does when a
> class object is assigned to a constant.
>
> Robert
Thanks Robert, but...

That is totally confusing.
So what you are saying is that some objects have names and some do not.
Since everything (almost) is an object, which objects or which  
classes would have names?
Oh, maybe I should go to bed. it's 6:20am here in Japan.

What about injecting my own name properties into a class, could I do  
this type of injection in a code block?

John Joyce