Is is possible to do something like super.super
in the overriden method? That is, to bypass the direct parent's super and call "grandparent's" super?
This is not recommended, but what you want is possible like this:
grandparent = self.class.superclass.superclass
meth = grandparent.instance_method(:the_method)
meth.bind(self).call
This works by first getting the grandparent class, then calling instance_method
on it to get an UnboundMethod
representing the grandparent's version of the_method
. It then uses UnboundMethod#bind
and Method#call
to call the grandparent's method on the current object.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With