I can’t seem to figure out a way to call a parent class’s implementation of a method from a different method and when that parent method is also redefined in the child. For example:
abstract class Foo def one "One" end def two "Two" end end class Bar < Foo def three one end def one "1" end end b = Bar.new # This should print One pp b.three
You can’t just use
self.one as that uses the child’s implementation.
::one doesn’t work as it looks for it on the top level.
super.one errors with
undefined method 'three' for Object (although this does work in Java). In PHP you could do
parent::one(); , which is basically the same as Java with a different keyword.
We probably should allow calling a different method on
super versus just having it assume the method you want is the one you’re calling it from?