[DOC] Mention block mode of String#unpack

This commit is contained in:
Nobuyoshi Nakada 2024-09-29 19:09:59 +09:00
parent e7144af750
commit 65a0795c3f
No known key found for this signature in database
GPG Key ID: 3582D74E1FEE4465
Notes: git 2024-09-29 11:45:37 +00:00

10
pack.rb
View File

@ -11,10 +11,14 @@ end
class String class String
# call-seq: # 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]. # See {Packed Data}[rdoc-ref:packed_data.rdoc].
def unpack(fmt, offset: 0) def unpack(fmt, offset: 0)
Primitive.attr! :use_block Primitive.attr! :use_block