Forum: Ruby A question about metaclass

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
sam.s.kong (Guest)
on 2005-11-24 03:31
(Received via mailing list)
Hi!

Some code first...

--------
class C
end

obj = C.new  #<-- Question here.
--------

My question is where the C.new method is.
The class Class or C's singleton class?

According to PickAxe2, it seems that C.new is in Class.
However, according to Little Ruby book, it seems that C.new is in C's
metaclass.

Which is right and how can we confirm that?

TIA.

Sam
james_b (Guest)
on 2005-11-24 03:51
(Received via mailing list)
Sam K. wrote:
>
> My question is where the C.new method is.
> The class Class or C's singleton class?
>
> According to PickAxe2, it seems that C.new is in Class.
> However, according to Little Ruby book, it seems that C.new is in C's
> metaclass.

What is "Little Ruby book"?


James
Bernhard (Guest)
on 2005-11-24 10:25
james_b wrote:
> Sam K. wrote:
>>
>> My question is where the C.new method is.
>> The class Class or C's singleton class?
>>
>> According to PickAxe2, it seems that C.new is in Class.
>> However, according to Little Ruby book, it seems that C.new is in C's
>> metaclass.
>
> What is "Little Ruby book"?
>
>
> James

http://www.visibleworkings.com/little-ruby/ ,"A Little Ruby, A Lot of
Objects", book fragment by Brian M., a real gem!

Regards, Bernhard
This topic is locked and can not be replied to.