Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't set if args are blank #135

Merged
merged 1 commit into from
Jun 11, 2016
Merged

Conversation

bakunyo
Copy link
Contributor

@bakunyo bakunyo commented May 16, 2016

I want to change the action of named arguments #with_defaults.
followings are example.

# rake file
task :some_task => [:a, :b] do |task, args|
  args.with_defaults({a: 'a', b: 'b'})
  p args.to_hash
end

# execute(now master)
rake some_task[,c]  # => {:a=>"", :b=>"c"}

# execute(expected)
rake some_task[,c]  # =>  {:a=>"a", :b=>"c"}

Rake::TaskArguments are separated by comma, so when I want default value for :a but specify for :b, want to use arguments [,any].

Please let me know if any problems, I will fix my code and resend pull request.

@hsbt hsbt merged commit ca5eec6 into ruby:master Jun 11, 2016
@hsbt
Copy link
Member

hsbt commented Jun 11, 2016

It's reasonable. I feld [,c] means [nil, c] too. It's better to use default argument.

@bakunyo
Copy link
Contributor Author

bakunyo commented Jun 16, 2016

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants