From: Erik Veenstra Date: 2006-07-23T16:36:29+09:00 Subject: Re: Set an instance variable before and after initialize That won't work: initialize is private. And it might better to overwrite Object.new, so it works for all classes. What about singleton? (I mean "include Singleton".) gegroet, Erik V. - http://www.erikveen.dds.nl/ ---------------------------------------------------------------- class Object def self.new( *args, &blk ) o = allocate o.instance_variable_set( "@foo", "anything") o.instance_eval{initialize( *args, &blk )} o.instance_variable_set( "@bar", "anything") o end end class Foo def initialize(baz) @baz = baz end def bar p @foo p @bar p @baz end end Foo.new(8).bar ----------------------------------------------------------------