Hi,

In the code below, is there a way to learn @foo from $bar_one
using $bar_two?

Many thanks in advance!!


----------------

#!/usr/bin/ruby -w

module Foo
   def setup
      @foo = self.object_id
   end
   def foo
      return @foo
   end
end

class Bar
   include Foo
end

$bar_one = Bar.new
$bar_one.setup
p $bar_one.foo  # => 2148224640

$bar_two = Bar.new
p $bar_two.foo  # => warning: instance variable @foo not initialized

----------------

-- 
Posted via http://www.ruby-forum.com/.