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

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-forum.com/.

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.) :slight_smile:

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-forum.com/\.