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

stdlib: Accept keyword arguments in Net::HTTP.start #2225

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

euglena1215
Copy link
Contributor

In the original definition, keyword arguments could not be specified without specifying all positional arguments.

Specifically, the following call results in an error with Ruby::ArgumentTypeMismatch.

Net::HTTP.start('www.ruby-lang.org', 443, use_ssl: true)

This is because opt is treated as a hash positional argument.
This problem is solved by treating opt as a variable-length keyword argument.

ref. https://docs.ruby-lang.org/ja/latest/method/Net=3a=3aHTTP/s/start.html

In the original definition, keyword arguments could not be specified
without specifying all positional arguments.

Specifically, the following call results in an error with
`Ruby::ArgumentTypeMismatch`.

```rb
Net::HTTP.start('www.ruby-lang.org', 443, use_ssl: true)
```

This is because opt is treated as a hash positional argument.
This problem is solved by treating opt as a variable-length keyword argument.

ref. https://docs.ruby-lang.org/ja/latest/method/Net=3a=3aHTTP/s/start.html
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.

1 participant