aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorAdam Daniels <adam@mediadrive.ca>2024-04-02 10:07:52 -0400
committerNobuyoshi Nakada <nobu@ruby-lang.org>2024-04-03 09:55:24 +0900
commitb664590c4d7bb6cd4f48c61c3d8a480cd887672c (patch)
treeb90fb8672596ffd97b51ead9c25eeefa195aebc0 /doc
parent24a740796050b72aa2d35339ba2a317d4eda7b75 (diff)
downloadruby-b664590c4d7bb6cd4f48c61c3d8a480cd887672c.tar.gz
[DOC] Fix examples for `u` packing directive
The directive is a lowercase `u` instead of an uppercase `U`. Adjusted input and output to match. Reported by Leah Neukirchen.
Diffstat (limited to 'doc')
-rw-r--r--doc/packed_data.rdoc10
1 files changed, 6 insertions, 4 deletions
diff --git a/doc/packed_data.rdoc b/doc/packed_data.rdoc
index ec0e2c07f0..17bbf92023 100644
--- a/doc/packed_data.rdoc
+++ b/doc/packed_data.rdoc
@@ -554,10 +554,12 @@ for one byte in the input or output string.
- <tt>'u'</tt> - UU-encoded string:
- [0].pack("U") # => "\u0000"
- [0x3fffffff].pack("U") # => "\xFC\xBF\xBF\xBF\xBF\xBF"
- [0x40000000].pack("U") # => "\xFD\x80\x80\x80\x80\x80"
- [0x7fffffff].pack("U") # => "\xFD\xBF\xBF\xBF\xBF\xBF"
+ [""].pack("u") # => ""
+ ["a"].pack("u") # => "!80``\n"
+ ["aaa"].pack("u") # => "#86%A\n"
+
+ "".unpack("u") # => [""]
+ "#86)C\n".unpack("u") # => ["abc"]
== Offset Directives