From: Freeman Pascal Date: 2001-03-16T15:26:41+09:00 Subject: [ruby-talk:12717] RE: Accessing caller of include or extend... Hello again, Using the info that Guy Decoux sent me about Module.append_features I was able to answer both my original questions. Here are the answers for any other Ruby newbies out there. Q: When creating a module for inclusion by a class, is there a way to initialize module instance variables being added to the including class? A: Yes, simply provide an initialize() method in your module and set your instance variables as you would in any class. Also, be sure to call super in your initialize() method in both your class doing the including and the module you are including. Q: Is there a way to determine within the module definition at run-time who the including class is (i.e. who called "include")? A: Yes - overriding the included modules append_features() method will allow you to determine the including class. [Credit to Guy Decoux who's code I lifted from his reply] #!/usr/bin/ruby module A def A.append_features(klass) puts "class #{klass}" super end end class B include A end pigeon% b.rb class B -Freeman