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-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Shouldn't it be self >> class, or am I dyslexic?
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password