From ruby 2.2 you can use super_method like this:
Class A
def pr
puts "pr"
end
end
Class B < A
def pr
puts "Super method: #{method(:pr).super_method}"
end
end
As super_method returns a Method, you can chain them to find the ancestor:
def ancestor(m)
m = method(m) if m.is_a? Symbol
super_m = m.super_method
if super_m.nil?
return m
else
return ancestor super_m
end
end