Re-defining an initialize method

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.

2006/4/16, Dirk M. [email protected]:

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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs