Merge pull request #15729 from dduugg/inreplace-sig
This commit is contained in:
commit
aa74840dc4
@ -2472,11 +2472,20 @@ 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
|
||||
onoe e.to_s
|
||||
raise BuildError.new(self, "inreplace", paths, {})
|
||||
args = paths.is_a?(Array) ? paths : [paths]
|
||||
raise BuildError.new(self, "inreplace", args, {})
|
||||
end
|
||||
|
||||
protected
|
||||
|
@ -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 = {}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user