From: Dave Thomas Date: 2001-08-19T02:53:54+09:00 Subject: [ruby-talk:19977] Re: How to do arbitrary super calls? Ned Konz writes: > So how do you do the Ruby equivalent of this Smalltalk (pseudocode, Child > inherits from Parent)? > > Parent>>a > "do something" > > Parent>>b > "do something else" > > Child>>a > "do something" > super a > > Child>>b > super a "get the original behavior of a, not the overridden" > "do something else" class A def a puts "A#a" end def b puts "A#b" end end class B < A alias :super_a :a def a puts "B#a" super end def b puts "B#b" super_a end end b = B.new b.a b.b > This is a pattern that comes up from time to time. I'm trying to think when I'd see this and not think to myself: there's something wrong here. Dave