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

More on IO doc #9842

Merged
merged 2 commits into from Feb 9, 2024
Merged

More on IO doc #9842

merged 2 commits into from Feb 9, 2024

Conversation

BurdetteLamar
Copy link
Member

Improve documentation for line-oriented IO (which I suspect is of greatest interest to many users).

@BurdetteLamar BurdetteLamar added the Documentation Improvements to documentation. label Feb 5, 2024
* - IO#readlines: Returns all remaining lines in an array.
* === Line Input
*
* \Class \IO supports line-oriented input for
Copy link
Member

Choose a reason for hiding this comment

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

At Auto-Linking:

If not, or if you suppress autolinking, consider forcing monofont.

Suggested change
* \Class \IO supports line-oriented input for
* \Class +IO+ supports line-oriented input for

"Class" is "the word in question does not refer to a Ruby entity", so it should be rendered as a normal text.
But "IO" is "the reference is to the current class document", it should be rendered as code, I think.

Copy link
Member Author

Choose a reason for hiding this comment

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

@nobu, point taken. There are many of these in this class overview. Most should be changed as you've indicated; some may be better rendered as I/O. If okay with you, I'd like to handle in the next PR instead of complicating matters here.

io.c Outdated
Comment on lines 15175 to 15177
* p f.gets
* p f.gets
* p f.gets
Copy link
Member

Choose a reason for hiding this comment

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

I think this is more consistent with the rest of the docs:

Suggested change
* p f.gets
* p f.gets
* p f.gets
* f.gets # => "First l"
* f.gets # => "ine\nSecond l"
* f.gets # => "ine\n\nFourth l"

Copy link
Member Author

Choose a reason for hiding this comment

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

FIxed (and "Output" below removed).

* Each of the {line input methods}[rdoc-ref:IO@Line+Input]
* accepts two special values for parameter +sep+:
*
* - +nil+: The entire stream is to be read ("slurped") into a single string:
Copy link
Member

Choose a reason for hiding this comment

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

Nit: why are we calling it "slurp"? It doesn't seem like a term used anywhere in the docs.

Copy link
Member Author

Choose a reason for hiding this comment

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

The term is well established in other interpreted languages (Perl and Python in particular), where its meaning is "read it all."

@BurdetteLamar
Copy link
Member Author

@peterzhu2118, if you approve this, please don't merge it; I can then go ahead and take care of the comment from @nobu (re \IO).

@BurdetteLamar
Copy link
Member Author

@peterzhu2118, can we go ahead and get this merged?

@peterzhu2118 peterzhu2118 merged commit 80490ac into ruby:master Feb 9, 2024
25 checks passed
@BurdetteLamar BurdetteLamar mentioned this pull request Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Improvements to documentation.
3 participants