As for your real use case: there is no need to check the arguments yourself. Just call
super(arg1)
and Ruby will raise an ArgumentError if the argument count does not match.
Update
Due to some downvotes, I think I should answer your original question.
How to get the super attribute?
Starting with Ruby 2.2, Method#super_method and UnboundMethod#super_method :
class A def foo(arg) end end class B < A def foo(arg1, arg2) end end B.instance_method(:foo).arity
Inside B#foo you can write:
class B < A def foo(arg1, arg2) method(__method__).super_method.arity
Stefan
source share