PHP 8.2.31
Preview: unpack1.rb Size: 536 B
//proc/thread-self/root/opt/alt/ruby40/share/ruby/prism/polyfill/unpack1.rb

# frozen_string_literal: true

# Polyfill for String#unpack1 with the offset parameter. Not all Ruby engines
# have Method#parameters implemented, so we check the arity instead if
# necessary.
if (unpack1 = String.instance_method(:unpack1)).respond_to?(:parameters) ? unpack1.parameters.none? { |_, name| name == :offset } : (unpack1.arity == 1)
  String.prepend(
    Module.new {
      def unpack1(format, offset: 0) # :nodoc:
        offset == 0 ? super(format) : self[offset..].unpack1(format) # steep:ignore
      end
    }
  )
end

Directory Contents

Dirs: 0 × Files: 5

Name Size Perms Modified Actions
371 B lrw-r--r-- 2026-05-21 12:15:22
Edit Download
324 B lrw-r--r-- 2026-05-21 12:15:22
Edit Download
294 B lrw-r--r-- 2026-05-21 12:15:22
Edit Download
536 B lrw-r--r-- 2026-05-21 12:15:22
Edit Download
987 B lrw-r--r-- 2026-05-21 12:15:22
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).