From 88040063d0ec8aa64e0de2a3afae7286ec53bfdb Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Tue, 20 Dec 2022 09:25:05 +0100 Subject: [PATCH] Array#pack: document silent truncation Ref: [Feature #19245] At the very least this behavior should be documented. --- doc/packed_data.rdoc | 4 ++++ 1 file changed, 4 insertions(+) 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 %w[A a Z m] 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