Forum: Ruby re-defining an initialize method

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A16652fd5d83c0473bd1e39d9a2117a6?d=identicon&s=25 Dirk Meijer (Guest)
on 2006-04-16 15:37
(Received via mailing list)
hi all,
while editing a class, i caught myself doing this:

class Foobar
  alias initialize old_initialize
  def initialize
    old_initialize
    # code
  end
end

and it doesn't look nice to me, is this really horrible in any way? or
is it
something i should use, whenever needed?
greetings, Dirk.
A16652fd5d83c0473bd1e39d9a2117a6?d=identicon&s=25 Dirk Meijer (Guest)
on 2006-04-16 15:43
(Received via mailing list)
2006/4/16, Dirk Meijer <hawkman.gelooft@gmail.com>:

>
> and it doesn't look nice to me, is this really horrible in any way? or is
> it
> something i should use, whenever needed?
> greetings, Dirk.


i'm sorry, of course it should have been this:

alias old_initialize initialize

greetings, Dirk.
This topic is locked and can not be replied to.