Thanks to you and Robert for the quick answers. I think I get it now; I
was a little fuzzy on the notion of class instance variables before. I
now use a construct like so:
class A
class << self
attr_accessor :var
end
end
class B < A
class << self
def var
@var || superclass.var
end
end
end
to allow subclasses's instance variables to default to their
superclass's until and unless overridden.
That was the point I missed, but of course you did that nicely
![Smile :) :)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
.
I'll admit the class << self
syntax continues to mystify somewhat; can anyone proffer an explanation
that would help me grok it fully?
I will take a chance by saying that
class << A
def x...
end
end
is the same as
class A
def self.x
end
end
although there might be some subtle differences
Do e.g, this
class << A
puts self
end
you can see kind of a Proxy object, but it behaves pretty much transparently.
Cheers
Robert