From: "Jan E." Date: 2012-06-10T16:51:22+09:00 Subject: Re: Accessing Variables from Within a Module Doug Jolley wrote in post #1063913: > What I sorely need is a block that > would allow me to access the accessor methods that are outside the block > but would otherwise enforce its own namespace. You could wrap the mixin module into another module. Then you'll have namespace separation. But you should use a mixin or inheritance or a wrapper in any case, even if you stick to your approach of letting others edit the code. Because binding a module to a certain variable created at top level (like in your first example) really makes no sense. It breaks the principle of scopes and creates obscure dependencies. While you can do it with some hacks, it is just bad design. A module should not depend on outer values, except for constants and maybe global variables. So this is how you could create a template for others to edit: # -- file 1: -- class MyFixedClass # don't edit this end # -- file 1. -- # -- file 2: -- module EditorNamespace # variant 1: using inheritance class EditorClass < MyFixedClass # you may edit this end # variant 2: using a mixin (has to be included in MyFixedClass) module EditorMixin # you may edit this end # variant 3: using a wrapper class EditorWrapper def initialize @my_fixed = ::MyFixedClass.new end # you may edit this (the original instance is in @my_fixed) end end # -- file 2. -- -- Posted via http://www.ruby-forum.com/.