utils/inreplace: fix Rubocop warnings.
This commit is contained in:
parent
1f2abbdd6e
commit
ecf46b841b
@ -1,9 +1,9 @@
|
|||||||
module Utils
|
module Utils
|
||||||
class InreplaceError < RuntimeError
|
class InreplaceError < RuntimeError
|
||||||
def initialize(errors)
|
def initialize(errors)
|
||||||
super errors.inject("inreplace failed\n") { |s, (path, errs)|
|
super errors.inject("inreplace failed\n") do |s, (path, errs)|
|
||||||
s << "#{path}:\n" << errs.map { |e| " #{e}\n" }.join
|
s << "#{path}:\n" << errs.map { |e| " #{e}\n" }.join
|
||||||
}
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ module Utils
|
|||||||
if before.nil? && after.nil?
|
if before.nil? && after.nil?
|
||||||
yield s
|
yield s
|
||||||
else
|
else
|
||||||
after = after.to_s if Symbol === after
|
after = after.to_s if after.is_a? Symbol
|
||||||
s.gsub!(before, after, audit_result)
|
s.gsub!(before, after, audit_result)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ module Utils
|
|||||||
Pathname(path).atomic_write(s)
|
Pathname(path).atomic_write(s)
|
||||||
end
|
end
|
||||||
|
|
||||||
raise InreplaceError.new(errors) unless errors.empty?
|
raise InreplaceError, errors unless errors.empty?
|
||||||
end
|
end
|
||||||
module_function :inreplace
|
module_function :inreplace
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user