Sha256: c43b16c872966a214805e737aa34257e36eb6001c7b5f5a5cde67c8dd2a2ea3a

Contents?: true

Size: 361 Bytes

Versions: 3

Compression:

Stored size: 361 Bytes

Contents

# frozen_string_literal: true

# Polyfill for String#unpack1 with the offset parameter.
if String.instance_method(:unpack1).parameters.none? { |_, name| name == :offset }
  String.prepend(
    Module.new {
      def unpack1(format, offset: 0) # :nodoc:
        offset == 0 ? super(format) : self[offset..].unpack1(format) # steep:ignore
      end
    }
  )
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
prism-0.27.0 lib/prism/polyfill/string.rb
prism-0.26.0 lib/prism/polyfill/string.rb
prism-0.25.0 lib/prism/polyfill/string.rb