From: Doug Jolley Date: 2012-06-10T08:24:03+09:00 Subject: Accessing Variables from Within a Module I have the following Ruby script: #!/usr/bin/ruby class MyClass def initialize() @fname='doug' end attr_accessor(:fname) end my_instance=MyClass.new() module MyModule def MyModule.test1() puts(my_instance.fname()) end end MyModule.test1() The purpose of the above script is to determine how I can access the @fname instance variable from within the module. The script as shown does not work. I'm not too surprised about that. However, I thought the problem could be cured by changing the local variable, "my_instance" to an instance variable (i.e., @my_instance). That didn't work either. That did surprise me. Can anyone tell me how I can skin this cat? Thanks. ... doug -- Posted via http://www.ruby-forum.com/.