Being still somewhat new to Ruby, I'm not sure how to do this... Let's say I have a method that takes a variable number of arguments:
def mytest(*args) puts args.to_json end
Obviously I can call it with whatever I like, such as:
mytest('one', 'two', 'three')
No problem. But what I need to do is call it with a dynamically-created set of arguments. For example, I'm pulling a result set from the database, and I don't know how many entries will come back. Let's say I want to collect the result ids, and call mytest() with them -- how would I construct the set of arguments to pass to mytest()?
This seems somehow obvious, but for whatever reason, it isn't. I realize that I could instead write mytest() to take an array or Hash, but I'm actually trying to call a method in a plugin that I didn't write.