G
Googy
module Mod
alias_method rig_exit, :exit
def exit(code=0)
puts "Exiting with code #{code}"
orig_exit(code)
end
end
include Mod
exit(99)
Above snippet we are creating new alias (orig_exit) for already
existing method exit. Interesting thing is orig_exit is again called
in exit method, why won't this behavior cause recursive calling of
method it self since orig_exit is simply alias to exit method ?
alias_method rig_exit, :exit
def exit(code=0)
puts "Exiting with code #{code}"
orig_exit(code)
end
end
include Mod
exit(99)
Above snippet we are creating new alias (orig_exit) for already
existing method exit. Interesting thing is orig_exit is again called
in exit method, why won't this behavior cause recursive calling of
method it self since orig_exit is simply alias to exit method ?