From: Daniel Schierbeck Date: 2005-11-26T06:27:27+09:00 Subject: Re: pattern: auto-running module init code A different approach than the `initialized' method, which would naturally be run after the class's `initialize' method had been called, would be an 'instantiated' method, which would be called *before* `initialize'. I actually think that's better, because that makes it possible for `initialize' to take advantage of the things changed by the module initialization code. module Fooable def self.instantiated(obj, *args, &block) obj.instance_eval do @foo = "something" end end end class Klass include Fooable def initialize puts @foo # -> something end end This will be a lot harder to implement though, as the module method `instantiated' must be called on all modules included by a class *before* its `initialize' method is called. That isn't possible by simply overriding Class#new... Cheers, Daniel Cheers, Daniel