From: "Jan E." Date: 2012-06-10T10:39:58+09:00 Subject: Re: Accessing Variables from Within a Module Doug Jolley wrote in post #1063908: > Suggestions? I'm wide open. Thanks for the input. From the description I'm guessing you want to use the module as a mixin to add methods to the class. In this case you don't even need the accessor methods. If you include the module in the class, the methods of the module have direct access to the instance variables -- just like they were defined in the class. As an example: #------ module M def mod_show puts "Value of @x: #{@x}" end end class C include M def initialize @x = 123 end end c = C.new c.mod_show #------ However, letting others edit parts of the code is a pretty odd way of extending functionalities. In object oriented languages (like Ruby), the standard way to do this is via inheritance: You derive a new class from an old one and extend it to your needs. Some languages like Java also let the programmer prevent methods from being changed in subclasses (what you want to do). But Ruby is very dynamic and not so much aimed at making code unchangeable. -- Posted via http://www.ruby-forum.com/.