Fix inreplace sig

Implicit Pathname strings strike again
This commit is contained in:
Douglas Eichelberger 2023-07-21 19:48:28 -07:00
parent 5226cd4344
commit 11a9086b89
2 changed files with 10 additions and 2 deletions

View File

@ -2472,6 +2472,14 @@ class Formula
#
# @see Utils::Inreplace.inreplace
# @api public
sig {
params(
paths: T.any(T::Array[T.untyped], String, Pathname),
before: T.nilable(T.any(Regexp, String)),
after: T.nilable(T.any(Pathname, String, Symbol)),
audit_result: T::Boolean,
).void
}
def inreplace(paths, before = nil, after = nil, audit_result = true) # rubocop:disable Style/OptionalBooleanParameter
super(paths, before, after, audit_result)
rescue Utils::Inreplace::Error => e

View File

@ -41,12 +41,12 @@ module Utils
params(
paths: T.any(T::Array[T.untyped], String, Pathname),
before: T.nilable(T.any(Regexp, String)),
after: T.nilable(T.any(String, Symbol)),
after: T.nilable(T.any(Pathname, String, Symbol)),
audit_result: T::Boolean,
).void
}
def inreplace(paths, before = nil, after = nil, audit_result = true) # rubocop:disable Style/OptionalBooleanParameter
after = after.to_s if after.is_a? Symbol
after &&= after.to_s
errors = {}