[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Shouldn't it be self >> class, or am I dyslexic?

Ben Tompkins

9/1/2007 1:03:00 AM

The semantics of

class X

...

class << self
def instance_method_for_class_object_named_X
...
end
end

end

is that an instance method is added (appended) to the current object X
== self by
the class definition that encloses the new method. Because we are
appending a new method to self, the arrows should point towards "self"
not "class."

nbits
--
Posted via http://www.ruby-....

1 Answer

Ben Tompkins

9/1/2007 1:15:00 AM

0

Oops,

Subject should read "... class >> self ..."

(Ok, maybe I am dyslexic -- but I'm still right -- just takes me a
couple
of tries to get the sequencing right.) :)

Ben Tompkins wrote:

> The semantics of
>
> class X
>
> ...
>
> class << self // I think it should be class >> self.
> def instance_method_for_class_object_named_X
> ...
> end
> end
>
> end
>
> is that an instance method is added (appended) to the current object X
> == self by
> the class definition that encloses the new method. Because we are
> appending a new method to self, the arrows should point towards "self"
> not "class."
>
> nbits

--
Posted via http://www.ruby-....