Class << self VS extend self

Hi.

What’s the difference between subject?

On Tue, Jun 26, 2012 at 1:40 AM, Aleksey Z. [email protected]
wrote:

What’s the difference between subject?

The comparison does not really make much sense IMHO since both do very
different things:

“class <<self … end” opens the singleton class of the instance
referenced to by “self”.

“extend self” only works if “self” references a module. It will
include a module’s instance methods in the module instance itself -
making them class methods.

Cheers

robert

On Tue, 26 Jun 2012 20:10:42 +0900
Robert K. [email protected] wrote:

making them class methods.
Thank you.


Sincerely yours,
Aleksey V. Zapparov A.K.A. ixti
FSF Member #7118
Mobile Phone: +34 677 990 688
Homepage: http://www.ixti.net
JID: [email protected]

*Origin: Happy Hacking!