The default method to pass arguments to Rake tasks is to give the parameters in square brackets –
desc 'Method #1: Use the default rake way to add two numbers and log the result' task :add, [:num1, :num] do |t, args| puts args[:num1].to_i + args[:num].to_i end
Reference: 4 ways to pass arguments to a Rake task
$ rake add[1,2] # => 3
However, I would rather pass the arguments like this –
$ rake add 1 2 # => 3Continue reading