There's no simple way to do this. One possibility is to create a
separate class method that is responsible for building the object, and
then making the :new method private:

class MyClass
  class <<self
    def build
      instance = new
      instance.some_attr = "some_value"
    end
    private :new
  end
end

Of course, subclasses could still override the build method, so you're
not 100% safe. As far as I know, there's no way you could be in Ruby.

Mat

On Fri, Feb 12, 2010 at 16:50, Xeno Campanoli <xeno.campanoli / gmail.com> wrote:
> I have an initialize method I want to run at the end of any daughter or
> granddaughter 'initialize' to make sure the state has been created properly,
> and I would rather specify the execution from the base class itself than
> count on those descendents to do it.
>
> xc
>
> --
> "It's the preponderance, stupid!" - Professor Stephen Schneider, IPCC member
>
>