I'm attempting to create a rake task that takes a required first argument, and then any number of additional arguments which I want to lump together into an array:
rake course["COURSE NAME", 123, 456, 789]
I've tried the following but args[:numbers]
is simply a string w/ 123
instead of all of the numbers.
task :course, [:name, *:numbers] => :environment do |t, args|
puts args # {:name=>"COURSE NAME", :numbers=>"123"}
end
rake course["COURSE NAME", [123, 456, 789]]
? – Cutcherry{:name=>"COURSE NAME", :numbers=>"[123"}
which is really bizarre. – Hindsrake course["COURSE NAME",123,456,789]
– Light{:name=>"COURSE NAME", :numbers=>"123"}
– Hinds