I\'ve used super
to initialize parent class but I cannot see any way of calling parent class from subclass methods.
I know PHP and other languages do ha
If the method is the same name, i.e. you're overriding a method you can simply use super
. Otherwise you can use an alias_method
or a binding.
class Parent
def method
end
end
class Child < Parent
alias_method :parent_method, :method
def method
super
end
def other_method
parent_method
#OR
Parent.instance_method(:method).bind(self).call
end
end