invalid_arity method similar to method missing ?

D

didier.prophete

all,

Is there a function similar to method_missing when an existing method
is called with the wrong number of arguments ?

Suppose I have a class:
class MyClass
def my_func(var1, var2)
end
end

And then I end up calling:
MyClass.new.my_func

As expected, I end up getting an ArgumentError exception ('wrong number
of arguments...). Is there a way to catch these... something like a
'method_missing' (method_missing doesn't get called since the method
exists...)

-Didier

ps: obviously, for simple problems, I could end up using some default
argument values, but it won't work for the (real and more complex)
problem I am trying to solve...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top