From 65a0795c3f92be5bff27211600cf3a832ab43b2f Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sun, 29 Sep 2024 19:09:59 +0900 Subject: [PATCH] [DOC] Mention block mode of `String#unpack` --- pack.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pack.rb b/pack.rb index b6e29c3eab..e70c6c7dc8 100644 --- a/pack.rb +++ b/pack.rb @@ -11,10 +11,14 @@ end class String # call-seq: - # unpack(template, offset: 0) -> array + # unpack(template, offset: 0, &block) -> array + # + # Extracts data from +self+. + # + # If +block+ is not given, forming objects that become the elements + # of a new array, and returns that array. Otherwise, yields each + # object. # - # Extracts data from +self+, forming objects that become the elements of a new array; - # returns that array. # See {Packed Data}[rdoc-ref:packed_data.rdoc]. def unpack(fmt, offset: 0) Primitive.attr! :use_block