I tried this code in order to send arguments to Ruby program:
namespace :tnx do
require_relative "transactions.rb"
include Cnp_transactions_modes
task :generate, [:clean_all] => [:environment] do |t, args|
if args[: clean_all] == 'true'
// something
end
if args[:times]
Cnp_transactions_modes.create_tnx(args[:times])
else
puts "\nSet some number\n"
end
end
end
When I run the code this way:
bundle exec rake test:generate['true','30']
I get Set some number
Can you give some advice how I can fix the code?