Robert Klemme wrote:
> class Base
>   class <<self
>     attr_accessor :foo
>   end
> 
>   def foo
>     Base.foo
>   end
> 
>   def foo=(x)
>     Base.foo=x
>   end
> end
> 
> class A < Base
> end
> 
> class B < Base
> end
> 
> B.new.foo=123
> puts A.new.foo

Then you need an instance to set a class attribute. What about this?
(Instance methods would be easy to add.)

class Base
   def self.foo
     if self == Base
       @foo
     else
       Base.foo
     end
   end

   def self.foo=(x)
     if self == Base
       @foo = x
     else
       Base.foo = x
     end
   end
end

class A < Base
end

class B < Base
end

B.foo=123
puts A.foo

-- 
       vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407