Skip to content

Conversation

casperisfine
Copy link
Contributor

[Feature #20594]

A handy method to construct a string out of multiple chunks.

Contrary to String#concat, it doesn't do any encoding negociation, and simply append the content as bytes regardless of whether this result in a broken string or not.

It's the caller responsibility to check for String#valid_encoding? in cases where it's needed.

When passed integers, only the lower byte is considered, like in String#setbyte.

This comment has been minimized.

@casperisfine casperisfine changed the title Implement String#append_as_bytes(String | Integer, ...) Implement String#append_as_bytes(String | Integer, ...) Sep 5, 2024
[Feature #20594]

A handy method to construct a string out of multiple chunks.

Contrary to `String#concat`, it doesn't do any encoding negociation,
and simply append the content as bytes regardless of whether this
result in a broken string or not.

It's the caller responsibility to check for `String#valid_encoding?`
in cases where it's needed.

When passed integers, only the lower byte is considered, like in
`String#setbyte`.
@casperisfine casperisfine force-pushed the string-append-as-bytes branch from c5782da to f5e63d4 Compare September 5, 2024 08:38
@byroot byroot requested a review from nirvdrum September 5, 2024 11:05
@byroot byroot merged commit 16f241f into ruby:master Sep 9, 2024
111 checks passed
peterzhu2118 added a commit to peterzhu2118/ruby that referenced this pull request Sep 10, 2024
String#append_as_bytes was newly introduced in ruby#11552.
peterzhu2118 added a commit that referenced this pull request Sep 10, 2024
String#append_as_bytes was newly introduced in #11552.
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