From: transfire@... Date: 2006-06-16T01:16:08+09:00 Subject: Re: Why the lack of mixing-in support for Class methods? Daniel Schierbeck wrote: > #class_extension is now private, the magic has been moved to > #append_features, and #class_extension has been undefined in Class, per > T's request. > > class Module > alias_method :__append_features__, :append_features > > def class_extension(&block) > @class_extension ||= Module.new do > def self.append_features(mod) > __append_features__(mod) > end > end > @class_extension.module_eval(&block) if block_given? > @class_extension > end > > private :class_extension > > def append_features(mod) > __append_features__(mod) > mod.extend(class_extension) > if mod.instance_of? Module > mod.send(:class_extension).send(:include, class_extension) > end > end > end > > class Class > undef_method :class_extension > end > > #send must of course be replaced with #funcall in 1.9 -- has there been > any progress with the naming of that? I checked the archives, but > couldn't find anything never than August '05... it sounds like a "fun > call", if you know what I mean... hopefully you don't. Isn't #funcall now called #instance_exec? T.