From: "chucke (Tiago Cardoso) via ruby-core" Date: 2024-01-10T12:46:19+00:00 Subject: [ruby-core:116152] [Ruby master Feature#20176] Array#pack: support offset kwarg Issue #20176 has been reported by chucke (Tiago Cardoso). ---------------------------------------- Feature #20176: Array#pack: support offset kwarg https://bugs.ruby-lang.org/issues/20176 * Author: chucke (Tiago Cardoso) * Status: Open * Priority: Normal ---------------------------------------- I was changing some code to use ruby 3.3's new `buffer` kwarg (great addition btw!) when using `Array#pack`. There are a few cases however, where I could perform the change, as not all my usages rely on appending; in some, I'm actually prepending it. To solve this, I'd like to propose the `offset` kwarg, which declares where to add the resulting string. picking up on example from the docs: [65, 66].pack('C*', buffer: 'foo') # => "fooAB" [65, 66].pack('C*', buffer: 'foo', offset: 0) # => "ABfoo" [65, 66].pack('C*', buffer: 'foo', offset: 1) # => "fABoo" -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/