From: Alex Stahl Date: 2010-10-01T06:48:31+09:00 Subject: Re: How to prevent overwriting methods by accident? I noticed that too. Super works fine in cases of inheritance, but the example wasn't inheriting, it was reopening. Though my first instinct was to try to use the "this" object in the "else..." statement to just use the current object to call the original method. But then I remembered ruby doesn't have "this". On Thu, 2010-09-30 at 16:06 -0500, Brian Candler wrote: > Josh Cheek wrote: > >> But is there a way to call the original method instead of just quitting > >> out? > >> > > The super keyword does this > > No it doesn't; not if you redefine a method in the same class. > > You need to use alias. > > class String > alias :orig_length :length > def length > puts "Whee!" > orig_length > end > end > puts "abc".length