Can someone please explain exactly what "class << self" does , I just
dont get it.
I was trying to alias some static methods with no luck but later found
some webpage saying that I need "class << self" to make the code run in
a static context.
I know that even if I make a static method inside Class, there is still
a "self" object , so I guess even though Im in a static method it
somehow belongs to the class object that represents the type Im calling
my static method on?
eg:
MyType.my_static_method(); #<- will execute in the context of the Class
instance "MyType" ?, or???
and when I do class << self , I'll enter the static context of "MyType"
, meaning "self" would no longer be "MyType" ?
and even if that is the case, why are all my local variables out of
scope inside that block?
I mean its still the same method that executes, or are the variables
somehow bound to the objects in which the method executes, even if they
are method local?
Im really confused here
//Roger
···
--
Posted via http://www.ruby-forum.com/.