--Boundary_(ID_r2IEULy2zX0IZ0IGJaGAKg)
Content-type: text/plain; CHARSET=US-ASCII
Content-transfer-encoding: 7BIT
Content-disposition: inline

Get uting @@foo instead of @foo

Sent from my HTC

----- Reply message -----
From: "Geometric Patterns" <geometric.patterns / gmail.com>
To: <ruby-talk / ruby-lang.org>
Subject: Question regarding interaction between modules and classes
Date: Sun, May 8, 2011 05:02


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  elf.object_id
   end
   def foo
      return @foo
   end
end

class Bar
   include Foo
end

$bar_one  ar.new
$bar_one.setup
p $bar_one.foo  # 2148224640

$bar_two  ar.new
p $bar_two.foo  # warning: instance variable @foo not initialized

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

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


--Boundary_(ID_r2IEULy2zX0IZ0IGJaGAKg)--