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] RDoc for character selectors #5632

Merged
merged 3 commits into from
Mar 8, 2022
Merged

[DOC] RDoc for character selectors #5632

merged 3 commits into from
Mar 8, 2022

Conversation

BurdetteLamar
Copy link
Member

This file will be a link target for methods doc that cites character selectors (e.g., String#tr),

It covers only the character selector; +replacement+ is discussed at String#tr (which will be revised and simplified); multiple selectors will be discussed at String#delete and String#count.

At line 29, the extra space is needed to render properly (at least on my machine).

@BurdetteLamar BurdetteLamar added the Documentation Improvements to documentation. label Mar 8, 2022
Comment on lines +6 to +9
- String#tr(selector, replacements): returns a new string.
- String#tr!(selector, replacements): returns +self+.
- String#tr_s(selector, replacements): returns a new string.
- String#tr_s!(selector, replacements): returns +self+.
Copy link
Member

Choose a reason for hiding this comment

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

Method definitions with multiple arguments don't render quite right compared to methods with single arguments. I think either we don't include method arguments here or manually link to the method definitions so that the links render consistently.

Screen Shot 2022-03-08 at 2 28 45 PM

Copy link
Member Author

Choose a reason for hiding this comment

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

These links all work for me. If the arguments' not rendering properly is a problem, I think it's an Rdoc problem. If the links work, I vote to keep the arguments; I think they clarify the semantics of the calls, especially the top four.

Copy link
Member

Choose a reason for hiding this comment

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

Good point. I've opened ruby/rdoc#871 which fixes this problem. Using that rdoc to build the HTML, it looks much better.

Screen Shot 2022-03-08 at 5 09 43 PM

Comment on lines +6 to +7
- String#tr(selector, replacements): returns a new string.
- String#tr!(selector, replacements): returns +self+.
Copy link
Member

Choose a reason for hiding this comment

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

#5626 called the method parameters replaceables and replacements, this should be consistent and use the same names.

Copy link
Member Author

Choose a reason for hiding this comment

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

When this PR is merged, #tr revision will be next -- unless you think it should be added here.

doc/character_selector.rdoc Outdated Show resolved Hide resolved
BurdetteLamar and others added 2 commits March 8, 2022 15:47
Co-authored-by: Peter Zhu <peter@peterzhu.ca>
@BurdetteLamar
Copy link
Member Author

Added a new commit with example of negation and range together.

@BurdetteLamar
Copy link
Member Author

@peterzhu2118: sorry, did not realize that I hadn't committed your change earlier. Now done.

Copy link
Member

@peterzhu2118 peterzhu2118 left a comment

Choose a reason for hiding this comment

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

Looks good!

@BurdetteLamar BurdetteLamar merged commit 1d35630 into ruby:master Mar 8, 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