summaryrefslogtreecommitdiff
path: root/doc/packed_data.rdoc
diff options
context:
space:
mode:
authorJean Boussier <byroot@ruby-lang.org>2022-12-20 09:25:05 +0100
committerBenoit Daloze <eregontp@gmail.com>2022-12-20 19:17:57 +0100
commit88040063d0ec8aa64e0de2a3afae7286ec53bfdb (patch)
tree3d5826347ec8c63f5152987453fd5b26ddf4e679 /doc/packed_data.rdoc
parent3ded50a36c0631aca17f363e68f6beff47713f7e (diff)
Array#pack: document silent truncation
Ref: [Feature #19245] At the very least this behavior should be documented.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/6969
Diffstat (limited to 'doc/packed_data.rdoc')
-rw-r--r--doc/packed_data.rdoc4
1 files changed, 4 insertions, 0 deletions
diff --git a/doc/packed_data.rdoc b/doc/packed_data.rdoc
index 9ba585c90b..ec13b24c69 100644
--- a/doc/packed_data.rdoc
+++ b/doc/packed_data.rdoc
@@ -60,6 +60,10 @@ Any directive may be followed by either of these modifiers:
Note: Directives in <tt>%w[A a Z m]</tt> use +count+ differently;
see {String Directives}[rdoc-ref:packed_data.rdoc@String+Directives].
+If elements don't fit the provided directive, only least significant bits are encoded:
+
+ [257].pack("C").unpack("C") # => [1]
+
=== Packing \Method
\Method Array#pack accepts optional keyword argument