[DOC] Tweaks for String#<<#13306
Merged
peterzhu2118 merged 2 commits intoruby:masterfrom May 14, 2025
BurdetteLamar:rb_str_concat_doc
Merged
[DOC] Tweaks for String#<<#13306peterzhu2118 merged 2 commits intoruby:masterfrom BurdetteLamar:rb_str_concat_doc
peterzhu2118 merged 2 commits intoruby:masterfrom
BurdetteLamar:rb_str_concat_doc
Conversation
Comment on lines
-4325
to
-4332
| * If that codepoint is not representable in the encoding of | ||
| * _string_, RangeError is raised. | ||
| * | ||
| * s = 'foo' | ||
| * s.encoding # => <Encoding:UTF-8> | ||
| * s << 0x00110000 # 1114112 out of char range (RangeError) | ||
| * s = 'foo'.encode(Encoding::EUC_JP) | ||
| * s << 0x00800080 # invalid codepoint 0x800080 in EUC-JP (RangeError) |
Member
There was a problem hiding this comment.
We lost information about this exception case, is that deliberate?
Member
Author
There was a problem hiding this comment.
Yes. In general, the doc guide discourages mentioning exceptions. In this case, I thought the error message for the raised exception explains itself.
Member
There was a problem hiding this comment.
The doc guide states:
For corner cases of methods, such as atypical usage, briefly mention the behavior, but do not provide any examples.
Only document exceptions raised if they are not obvious.
The error message might be obvious, but I don't think it's obvious what the behavior is for this exceptional case.
peterzhu2118
approved these changes
May 14, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.