From: Got Ascii Date: 2007-09-22T07:53:09+09:00 Subject: question re: modules and class variable scope I spent some time trying to find an answer to this but haven't found an explanation I understand. Could someone tell me what is going on here: module Mod def self.append_features(base) base.extend ClassMethods super end module ClassMethods def growl puts @@donkey end end end class Animal include Mod @@donkey = "heyhaw" def self.working_growl puts @@donkey end end # uninitialized class variable @@donkey in Mod::ClassMethods Animal.growl # works fine Animal.working_growl Now, in my limited understanding calling Animal.extend (or base in this case) ClassMethods should have added growl as a class method to Animal, equivalent to working_growl in scope (as it turns out self in both methods is Animal which confuses me even more). Clearly this is not the case. Any help would be appreciated. Thanks! -- Posted via http://www.ruby-forum.com/.