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

# frozen_string_literal: true

# Polyfill for String#byteindex, which didn't exist until Ruby 3.2.
if !("".respond_to?(:byteindex))
  String.include(
    Module.new {
      def byteindex(needle, offset = 0)
        charindex = index(needle, offset)
        slice(0...charindex).bytesize if charindex
      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).