>>>>> "E" == Elias Athanasopoulos <elathan / phys.uoa.gr> writes:

E> elathan@velka:~/src/ruby> ruby test.rb 
E> test.rb:7: undefined method `bar=' for Foo:Class (NoMethodError)

E> Is this behaviour normal?

 Yes, what you want is a class *instance* variable

svg% cat b.rb
#!/usr/bin/ruby
class A
   class << self
      attr_accessor :a
   end
end

A.a = 12
p A.a
svg% 

svg% b.rb
12
svg% 

 a class variable can be seen as a shared variable

svg% cat b.rb
#!/usr/bin/ruby
class A
   @@a = 12

   def self.a
      p @@a
   end

   def a
      p @@a
   end
end

class B < A
   def self.b
      p @@a
   end

   def b
      p @@a
   end
end

A.a
A.new.a

B.b
B.new.b
svg%
 
svg% b.rb
12
12
12
12
svg% 



	

Guy Decoux