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

[DOC] Add link targets #6602

Merged
merged 3 commits into from Oct 21, 2022
Merged

[DOC] Add link targets #6602

merged 3 commits into from Oct 21, 2022

Conversation

BurdetteLamar
Copy link
Member

This is battlespace preparation for making this page house the primary documentation for each stream-oriented method that appears in more than one class: e.g., gets, readlines.

The doc for the streaming classes (ARGF, File, IO, StringIO) will need to link the the individual methods here. Therefore I've reformatted each method's list item as a level-5 heading, which rdoc always recognizes as a link target (and always includes in the page's table of contents).

The next steps will be to:

  • Import doc for streaming methods like gets and readlines from wherever they now are.
  • Link from those places to the methods sections here.

@BurdetteLamar BurdetteLamar added the Documentation Improvements to documentation. label Oct 20, 2022
Comment on lines 295 to 300
may begin mid-line:

f = File.new('t.txt')
f.pos = 19
f.readlines # => ["ine\n", "\n", "Fourth line\n", "Fifth line\n"]
f.readlines # => []
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 the indentations of these lines need to be adjusted.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@@ -368,13 +406,21 @@ which is the non-negative integer line number
in the stream where the next read will occur.

The line number is the number of lines read by certain line-oriented methods
(IO.foreach, IO#each_line, IO#gets, IO#readline, and IO#readlines)
({#foreach}[https://docs.ruby-lang.org/en/master/IO.html#method-c-foreach],
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 foreach is a class method, so I think the convention is to use ::foreach.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done. I'll add something to the guide about this. We've been using Foo.bar when the class name is prefixed but ::bar when not.

@BurdetteLamar BurdetteLamar merged commit c7754a4 into ruby:master Oct 21, 2022
@BurdetteLamar
Copy link
Member Author

The next steps will be to:
* Import doc for streaming methods like gets and readlines from wherever they now are.
* Link from those places to the methods sections here.

Well, I've started with #read, and the first problem is that its section in io_streams.rdoc does not generate the call-seq. I can add those for each method section, but that would be offensively redundant, I think.

Another problem is that adding full method doc will, by enlarging each method section, spread out the methods, so that for, say "Line IO," the reader gets no sense of overview, which was the goal of the section in the first place.

No doubt further problems lurk (unknown unknowns).

I'm thinking that maybe we should abandon this page (it hasn't been released yet, right?), and move everything over to class IO. Then the full methods doc can live in its usual places (where the call-seqs are), and the class header material can treat the topics (as in this page).

I have no problem losing some of my effort here; better to get this right the first time.

@peterzhu2118, @jeremyevans (also, anyone else): Thoughts?

@BurdetteLamar
Copy link
Member Author

On second thought, maybe this page can be saved. The troubles began when I tried to import full doc for methods. Without those, maybe the page would be ok -- but that would mean backing out this merge, which we won't need. I'll think on it.

tenderlove pushed a commit to Shopify/ruby that referenced this pull request Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Improvements to documentation.
2 participants