From: "T. Onoma" Date: 2004-08-16T07:22:17+09:00 Subject: Re: Opinion on ClassInherit Include On Saturday 14 August 2004 11:06 am, Robert Klemme wrote: > This is a bit nicer: > > module Foo > # class code > class < attr_accessor :foo > def append_features(cl) > # need a copy of me to avoid state interference > copy = dup > cls = class< copy.singleton_methods.each do |m| > cls.send(:define_method, m, copy.method(m).to_proc) > end > super > end > end > # instance code > attr_accessor :bar > end That's pretty clever! And I think that's the kind of functionality most people would expect. It certainly was what I was looking for... at first. But now I'm shying away from module class-level methods. In fact, I'm putting almost all methods into modules now and including/extending them where I need them. Its to the point that I can clearly identify three type of modules: mixin, service and namespace. And the service modules I've started writting just like the mixins but with extend self: module AService extend self def ameth ... end ... end -- T.