Skip to content

Conversation

st0012
Copy link
Member

@st0012 st0012 commented Nov 22, 2024

Because this file's comments have one extra space after the # sign, almost every line is updated. IMO, it's better to address this issue in one go.

To ignore the whitespace changes, please use this link for review.

#
# - A first argument, +pattern+ (string or regexp),
# that specifies the substring(s) to be replaced.
# - A first argument, +pattern+ (String or Regexp),
Copy link
Member Author

Choose a reason for hiding this comment

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

Capitalizing changes like this will make them link to the relevant classes, which is an improvement IMO.

# - Inherits from {class Object}[rdoc-ref:Object@What-27s+Here].
# - Includes {module Comparable}[rdoc-ref:Comparable@What-27s+Here].
# - Inherits the {Object class}[rdoc-ref:Object@What-27s+Here].
# - Includes the {Comparable module}[rdoc-ref:Comparable@What-27s+Here].
Copy link
Member Author

Choose a reason for hiding this comment

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

FWIW, if in the future we can enable the --embed-mixins flag added by @flavorjones in ruby/ruby, these methods will be added to the String class's doc directly.

# - #chomp: Returns a copy of +self+ with a trailing record separator removed, if found.
# - #chop: Returns a copy of +self+ with trailing newline characters or the last character removed.
# - #squeeze: Returns a copy of +self+ with contiguous duplicate characters removed.
# - #[] (aliased as #slice): Returns a substring determined by a given index, start/length, range, regexp, or string.
Copy link
Member Author

Choose a reason for hiding this comment

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

I think it takes regexp too so I just added it:

irb(main):001> s = "foobar"
=> "foobar"
irb(main):002> s[/foo/]
=> "foo"

@st0012
Copy link
Member Author

st0012 commented Dec 10, 2024

@jeremyevans @peterzhu2118 would you mind giving this a look? Thx

Copy link
Contributor

@jeremyevans jeremyevans 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. I do have some suggestions for minor improvements, but I don't need to review again before merging.

@st0012
Copy link
Member Author

st0012 commented Dec 11, 2024

@jeremyevans Thanks for the suggestions!

@st0012 st0012 force-pushed the improve-string-rb-documentation branch from 7de8da9 to 38f487d Compare December 12, 2024 21:48
Because this file's comments have one extra space after the `#` sign,
almost every line is updated. IMO, it's better to address this issue
in one go.
@st0012 st0012 force-pushed the improve-string-rb-documentation branch from 38f487d to 81be59e Compare December 14, 2024 01:06
Copy link
Contributor

@jeremyevans jeremyevans 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. Only one change I would make.

Co-authored-by: Jeremy Evans <[email protected]>
@jeremyevans jeremyevans enabled auto-merge (squash) December 14, 2024 01:17
@jeremyevans jeremyevans merged commit 77016a7 into ruby:master Dec 14, 2024
42 checks passed
@st0012 st0012 deleted the improve-string-rb-documentation branch December 14, 2024 01:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants