Given an array of arguments, how do I send those arguments to a particular function in Ruby? Given an array of arguments, how do I send those arguments to a particular function in Ruby? arrays arrays

Given an array of arguments, how do I send those arguments to a particular function in Ruby?


As you know, when you define a method, you can use the * to turn a list of arguments into an array. Similarly when you call a method you can use the * to turn an array into a list of arguments. So in your example you can just do:

Ilike.new.turtles(*a)