Handle the rare case when renamed string is ".."

This commit is contained in:
Alex Ling 2020-06-09 09:42:28 +00:00
parent 45cdfd5306
commit e53641add1

View File

@ -129,15 +129,19 @@ module Rename
end
def render(hash : VHash)
@ary.map do |e|
str = @ary.map do |e|
if e.is_a? String
e
else
e.render hash
end
end.join
.strip
.gsub("/", "_")
end.join.strip
post_process str
end
private def post_process(str)
return "_" if str == ".."
str.gsub "/", "_"
end
end
end