Say I wanted to write my own version of File#open that adds some
functionality, but that will eventually want to call the original.
Is there some way I can add an alias to allow me to do that? I tried
doing something like, but I get an error telling me there's no method
called "original". Obviously, this is just a test to see whether it's
doable before I write the real code :-).
class File
alias original open
def File.open(*arguments)
original(arguments)
end
end
out = File.open("test", "w")
out.puts "Hello, world!"
out.close