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 This is sufficient, because "" and '' are object constructors: irb#1(main):001:0> 3.times { puts "foo".object_id } 1073547530 1073547510 1073547490 => 3 > will never work. Because you can't get self to become the instantiated > object. Which is kind of obvious because the object does not even exist when you define the module. :-) If you want a module to manipulate instance variables you do it the same way as with ordinary class instance methods. The major difference is that it's harder to initialize them during object creation because the class needs to cooperate (calling super in #initialize). The more robust approach is to assume that they are not initialized as David has shown in his example with @position. Kind regards robert