1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-02 22:58:01 +00:00
Files
til/ruby/passing-arguments-to-a-rake-task.md
2015-08-04 19:03:17 -05:00

428 B

Passing Arguments To A Rake Task

You can create a rake task that takes arguments by including an array of named arguments in the task declaration.

task :greeting, [:name] do |task, args|
  puts "Hello, #{args.name}!"
end

You can then pass an argument to that task when invoking it.

$ rake greeting[World]
Hello, World!

source