On Sat, Mar 22, 2008 at 11:34 AM, Robert Klemme
<shortcutter / googlemail.com> wrote:
> On 22.03.2008 09:34, Leon Bogaert wrote:
>  > Ah thanks David.
>  >
>  > And that's of course why
>  >
>  > Module X
>  >   instance_eval do
>  >     @testing = [1,2,3]
>  >   end
>  > end
>
>  This sets an instance variable of X.
>
>
>  > String.new('test').include(X)
>
>  'test'.include X
Do you mean extend?
And if so what good would that do, even if we had a reference to test
as the module does not define any methods.

I am very confused by this thread but somehow have the feeling that OP
wants this

module X
   def set
     @x=[*1..3]
   end
end
class C
    attr_reader :x
    include X
end
c=C.new
c.set
p c.x

and might get confused by
a='test'.extend X
a.set
p a.instance_variable_get("@x")

but at least it clearly shows that the included or extended method
that was defined in a module does precisely what OP doubted possible:
Accessing ivars.

HTH
Robert


-- 
http://ruby-smalltalk.blogspot.com/

---
Whereof one cannot speak, thereof one must be silent.
Ludwig Wittgenstein