Gary Wright
4/6/2009 9:01:00 PM
On Apr 6, 2009, at 4:35 PM, Kyle Schmitt wrote:
> How do you go about passing arrays as arguments to something like
> method_missing? I've got a method that takes an array as an argument,
> but calling it via method_missing is proving problematic. How do you
> deal with arrays in these situations?
>
> def method_missing(method,*args)
> if respond_to?method.to_s[/^add_([^$]+)/,1]
> @data<<method(method.to_s[/^add_([^$]+)/,1]).call(*args)
> else
> super method_missing(method,*args)
> end
> end
I think your problem is in the else clause. It should be:
else
super
end
You don't want to call method_missing explicitly, you'll create an
infinite recursion.