Extract array values when using Object.send?

How can I take an array, extract each top level value when using
Object.send on an object?.. See the example below…

class TestSend
def test( arg1, arg2, arg3)
puts arg1
puts arg2
puts arg3
end
end

t = TestSend.new
t.send(‘test’, ‘hey’, 1, ‘rrr’);

args = [‘hey’,1,‘rrr’]
t.send(‘test’, args); #this outputs an argument error, 3 for 1.

Thanks

On 1/13/07, warhero [email protected] wrote:

t = TestSend.new
t.send(‘test’, ‘hey’, 1, ‘rrr’);

args = [‘hey’,1,‘rrr’]
t.send(‘test’, args); #this outputs an argument error, 3 for 1.

Thanks

Use the splat op:

t.send(‘test’, *args)

sweet. Thanks.