Hello,

Does anyone have an idea how to dynamically add a _class_ variable to
extending classes?

I have code like this:

<code>

  class A
    
    class << self

      def property( token, value )
        unless value.kind_of?(Numeric)
          value = %Q{"#{value}"}
        end
        unless method_defined?(:properties)
          class_eval <<-EOD
            def properties
              ### >> ACCESS CLASS VARIABLE << ###
            end
          EOD
        end
        class_eval <<-EOD
          def #{token} 
            @#{token} ? @#{token} : @#{token} = #{value}
          end
          def #{token}=( value )
            @#{token} = value
          end
        EOD
      end

    end

  end

  class B < A
    property :a, 1
    property :b, "foo"
  end

  class C < A
    property :c, 10
  end

  ### Testing ###

  b1 = B.new
  b2 = B.new
  b1.c = 2
  c = C.new

  B.properties.each do
    |p| 
    puts "b1=#{b1.method(p).call},b2=#{b2.method(p).call}
  end

  puts c.c
   
</code>

Tad long, I know. Hopefully someone has any thoughts.

Regards, 

Renald