Array#pack: document silent truncation

Ref: [Feature #19245]

At the very least this behavior should be documented.
This commit is contained in:
Jean Boussier 2022-12-20 09:25:05 +01:00 committed by Benoit Daloze
parent 3ded50a36c
commit 88040063d0
Notes: git 2022-12-20 18:18:19 +00:00

View File

@ -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