From: me@... Date: 2007-04-10T23:25:06+09:00 Subject: What happens to instance variables in modules when they are extended into classes Hi, Please take a look at the code pasted at this URL (I will include the code in the body of this message (below) for future readers, but the rafb.net post will give readers for the next 24 hours something better to look at): http://rafb.net/p/9MkY3H79.html Why is it that an instance method of the module gets mixed into the class, but instance variables of the module do not get mixed in? Whats the best strategy for writing instance methods in a module that depend on some state in the mixee? Thanks very much, Mike. And now here is the code snippet: module M @module_instance_variable = 'miv' def module_instance_method @module_instance_variable end end class C extend M end puts "Is module_instance_method in the methods of the class? #{C.methods.include?('module_instance_method')}" puts "Is @module_instance_variable in the instance variables of the class? #{C.instance_variables.include?('@module_instance_variable')}" puts "Is @module_instance_variable in the class variables of the class? #{C.class_variables.include?('@module_instance_variable')}"