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

Improve IO.binread and IO.binwrite signatures #520

Merged
merged 1 commit into from
Dec 16, 2020
Merged

Improve IO.binread and IO.binwrite signatures #520

merged 1 commit into from
Dec 16, 2020

Conversation

ybiquitous
Copy link
Contributor

This change aims to improve the signatures of `IO.binread` and `IO.binwrite`.

- Add missing documents.
- Add missing tests.
- Improve the argument types of the `.binwrite` method.
# Same as IO.write except opening the file in binary mode and ASCII-8BIT
# encoding (`"wb:ASCII-8BIT"`).
#
def self.binwrite: (String name, _ToS string, ?Integer offset, ?mode: String mode) -> Integer
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[note] About the argument changes of .binwrite:

  • I remove optional arguments (open_args) except mode: because it is a misuse to specify encoding:, textmode: or autoclose: etc. for this method. But this removal is potentially breaking so I’m ready to revert it if you want.
  • More readable argument name: arg0 -> string (from the API doc)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable. Nice catch! 👏

@ybiquitous ybiquitous marked this pull request as ready for review December 16, 2020 14:12
@soutaro soutaro merged commit adaf5e4 into ruby:master Dec 16, 2020
@ybiquitous ybiquitous deleted the io-binread-and-binwrite branch December 16, 2020 14:57
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