Re-defining an initialize method


#1

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.


#2

2006/4/16, Dirk M. removed_email_address@domain.invalid:

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.