InreplaceError: fix undefined method crash
When the first parameter to inreplace was an array, and the replacement failed, InreplaceError would end up crashing with an undefined method exception because the order of operations resulted in super not being passed the value of the entire inject block.
This commit is contained in:
parent
ebf3d939d1
commit
ac7a593730
@ -1,9 +1,10 @@
|
||||
module Utils
|
||||
class InreplaceError < RuntimeError
|
||||
def initialize(errors)
|
||||
super errors.inject("inreplace failed\n") do |s, (path, errs)|
|
||||
formatted_errors = errors.inject("inreplace failed\n") do |s, (path, errs)|
|
||||
s << "#{path}:\n" << errs.map { |e| " #{e}\n" }.join
|
||||
end
|
||||
super formatted_errors
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user