[ruby/prism] Remove need for Natalie patches
https://github.com/ruby/prism/commit/7fc7e13476
This commit is contained in:
parent
444553b528
commit
b6489e9f62
@ -1,7 +1,9 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# Polyfill for String#unpack1 with the offset parameter.
|
# Polyfill for String#unpack1 with the offset parameter. Not all Ruby engines
|
||||||
if String.instance_method(:unpack1).parameters.none? { |_, name| name == :offset }
|
# 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(
|
String.prepend(
|
||||||
Module.new {
|
Module.new {
|
||||||
def unpack1(format, offset: 0) # :nodoc:
|
def unpack1(format, offset: 0) # :nodoc:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user