Ruby programmers typically use class << self
inside a class body to open up the class object's eigenclass, like so:
class Foo
class << self
# ...
end
end
However, I seldom see this equivalent form (assume that Foo
is already defined to be a class):
class << Foo
# ...
end
Is there a reason for preferring the first style to the second?