Array#pack: document silent truncation
Ref: [Feature #19245] At the very least this behavior should be documented.
This commit is contained in:
parent
3ded50a36c
commit
88040063d0
Notes:
git
2022-12-20 18:18:19 +00:00
@ -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;
|
Note: Directives in <tt>%w[A a Z m]</tt> use +count+ differently;
|
||||||
see {String Directives}[rdoc-ref:packed_data.rdoc@String+Directives].
|
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
|
=== Packing \Method
|
||||||
|
|
||||||
\Method Array#pack accepts optional keyword argument
|
\Method Array#pack accepts optional keyword argument
|
||||||
|
Loading…
x
Reference in New Issue
Block a user