From: Dale Martenson Date: 2002-09-11T01:56:27+09:00 Subject: RE: Refactoring Ruby This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C258EA.DB1C1F00 Content-Type: text/plain; charset="iso-8859-1" Rich Kilmer wrote: > How about this: > > class Foo > def [](index) > puts "Warning...[] called from #{caller}" > get_with_index(index) > end > def get_with_index(index) > #do something different > end > end Using "caller" is a great idea. If you need additional information, you can get a full backtrace by using: puts "Warning...[] called from " + caller.join(' <- ') ------_=_NextPart_001_01C258EA.DB1C1F00 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable RE: Refactoring Ruby

Rich Kilmer wrote:
> How about this:
>
> class Foo
>    def [](index)
>        puts = "Warning...[] called from #{caller}"
>        = get_with_index(index)
>    end
>    def = get_with_index(index)
>        #do = something different
>    end
> end

Using "caller" is a great idea. If you need = additional information, you can get a full backtrace by using:

     puts "Warning...[] = called from " + caller.join(' <- ')

------_=_NextPart_001_01C258EA.DB1C1F00--