Hi --

On Wed, 3 Nov 2004, Florian Weber wrote:

> hi!
> 
> how can i make that the example below returns 'Hello, my name is test'?
> 
> module Barable
>    def self.append_features(base)
>      base.extend(ClassMethods)
>      super
>    end
> 
>    module ClassMethods
>      def bar(bar)
>        @bar = bar
>      end
>    end
> end
> 
> class Foo
>    include Barable
>    bar "test"
> 
>    def hi
>      puts "Hello, my bar is #{@bar}"
>    end
> end
> 
> 
> Foo.new.hi

Your subject line says class variables, but here you're using instance
variables (which always belong to whatever object is 'self' at a given
point in execution).  Did you mean @@bar ?


David

-- 
David A. Black
dblack / wobblini.net