# lib/tasks/task_example.rake
namespace :namespace_1 do
# without this line the task will not be enumerated in rake -T
desc "Description"
task :task_name, [:params] => [:environment] do |t, arbitrary|
# it works as splat operator
params = arbitrary.extras.unshift arbitrary[:params] ? arbitrary[:params] : "no params"
p params
end
end
# run, without spaces between params: $ rake namespace_1:task_name[bla,bla2]
Last active
February 25, 2018 23:29
-
-
Save rplaurindo/5923333 to your computer and use it in GitHub Desktop.
$ rake namespace:task['Hello,Wolrd!']
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment