[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Sending Multiple Args to a Method Object

Eric Hodel

8/1/2006 11:41:00 PM

On Aug 1, 2006, at 4:04 PM, Harris Reynolds wrote:

> I am trying to call a method that has multiple arguments using
> reflection. However, when I invoke the method.call method passing
> the arguments as an array it chokes with the following error:
>
> ArgumentError (wrong number of arguments (1 for 4))
>
> The ruby interpreter thinks that my single array is the parameter I
> am passing in; however, the array I am passing in contains 4
> object that map directly to the 4 arguments the interpreter is
> looking for. Is there another way to accomplish this other than
> using method.call?

method.call(*[arg1, arg2, arg3, arg4])

--
Eric Hodel - drbrain@segment7.net - http://blog.se...
This implementation is HODEL-HASH-9600 compliant

http://trackmap.rob...