I’d like to pass a command wget to Ruby’s system method (the second version, that doesn’t pass the command to shell.) However, the number of arguments (websites to download) depends on what the user wants. Is there a way to do something like, pass an array of arguments with an arbitrary number of arguments [site1 site2 ...] to this method?
I’d like to pass a command wget to Ruby’s system method (the second version,
Share
You can use the
*splat operator in front of an array to expand it when calling a method, including thesystemmethod.