Skip to content
Snippets Groups Projects
Commit cc3eceb0 authored by Markus Reiter's avatar Markus Reiter
Browse files

Fix `inreplace` signature.

parent e3646c9b
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment