Fix inreplace
signature.
This commit is contained in:
parent
e3646c9b4e
commit
cc3eceb04f
@ -3,9 +3,8 @@
|
||||
module Utils::Inreplace
|
||||
include Kernel
|
||||
|
||||
sig { params(paths: T::Array[T.untyped], before: T.nilable(String), after: T.nilable(String), audit_result: T::Boolean).void }
|
||||
sig { params(paths: T::Array[T.untyped], before: T.nilable(String), after: T.nilable(T.any(String, Symbol)), audit_result: T::Boolean).void }
|
||||
def inreplace(paths, before = nil, after = nil, audit_result = true); end
|
||||
|
||||
end
|
||||
|
||||
class StringInreplaceExtension
|
||||
|
@ -28,6 +28,8 @@ module Utils
|
||||
#
|
||||
# @api public
|
||||
def inreplace(paths, before = nil, after = nil, audit_result = true) # rubocop:disable Style/OptionalBooleanParameter
|
||||
after = after.to_s if after.is_a? Symbol
|
||||
|
||||
errors = {}
|
||||
|
||||
errors["`paths` (first) parameter"] = ["`paths` was empty"] if paths.blank?
|
||||
@ -39,7 +41,6 @@ module Utils
|
||||
if before.nil? && after.nil?
|
||||
yield s
|
||||
else
|
||||
after = after.to_s if after.is_a? Symbol
|
||||
s.gsub!(before, after, audit_result)
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user