Zachary Holt
6/12/2007 5:48:00 PM
On Jun 12, 2007, at 10:34 AM, Mike Steiner wrote:
> Why is the constructor method named initialize? Why not name it new
> to be
> consistent?
Typically, :new is a class method, which calls the instantiated
object's :initialize instance method, if one is available, with the
parameters passed to :new.
You can override the class method :new (this is a good place to use
super), but be sure to return the newly minted object. Often you can
just override the :initialize instance method, however.
If there's no :new class method in your class definition, then you're
getting Object.new (or some other super class's :new).