From: Dossy Date: 2002-06-05T09:56:23+09:00 Subject: Re: Calling a (any) superclass method when already have one by that name On 2002.06.05, Philip Mateescu wrote: > So, how do I call a method of my superclass when I have a method with the > same name in my current class (i.e. is there any other way beside aliasing) >[...] > def bar > super.foo ?? how do I do this > end I ran into this before as well. I was _very_ surprised to find that #caller returned an Array of Strings (!!!). Very disappointed, I was really hoping it returned an Array of Objects themselves. I ran into this same problem with Java and was disappointed (you know, not being able to get a stack trace except as a string-based value). I was hoping to do something like: class A def foo puts "A#foo" end def bar puts "A#bar" caller[0].baz end def baz puts "A#baz" end end a = A.new p a.foo # => "A#foo" p a.baz # => "A#baz" p a.bar # => "A#bar"\n"A#baz" I don't know how useful this would be (or if it's possible to cleanly implement) but it's something I tried to make work at one point and gave up ... -- Dossy -- Dossy Shiobara mail: dossy@panoptic.com Panoptic Computer Network web: http://www.panoptic.com/ "He realized the fastest way to change is to laugh at your own folly -- then you can let go and quickly move on." (p. 70)