diff options
| author | BurdetteLamar <burdettelamar@yahoo.com> | 2025-11-16 20:40:43 +0000 |
|---|---|---|
| committer | Peter Zhu <peter@peterzhu.ca> | 2025-11-16 13:26:11 -0800 |
| commit | 43e26d02df845e9fc0ee597cbfa4425537e76020 (patch) | |
| tree | 9fc03ee81204b2f707755d348e98e47e0524a445 | |
| parent | 00521434a4a727e5a312ac9a42d48572ffa6388a (diff) | |
[DOC] Tweaks for String#unpack
| -rw-r--r-- | pack.rb | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -10,16 +10,18 @@ class Array end class String - # call-seq: - # unpack(template, offset: 0, &block) -> array + # call-seq: + # unpack(template, offset: 0) {|o| .... } -> object + # unpack(template, offset: 0) -> array # - # Extracts data from +self+. + # Extracts data from +self+ to form new objects; + # see {Packed Data}[rdoc-ref:packed_data.rdoc]. # - # If +block+ is not given, forming objects that become the elements - # of a new array, and returns that array. Otherwise, yields each - # object. + # With a block given, calls the block with each unpacked object. # - # See {Packed Data}[rdoc-ref:packed_data.rdoc]. + # With no block given, returns an array containing the unpacked objects. + # + # Related: see {Converting to Non-String}[rdoc-ref:String@Converting+to+Non--5CString]. def unpack(fmt, offset: 0) Primitive.attr! :use_block Primitive.pack_unpack(fmt, offset) |
