Simplify PATH#parse.

This commit is contained in:
Markus Reiter 2017-04-28 20:46:52 +02:00
parent 24f48ae7d9
commit 005f165dcb

View File

@ -65,11 +65,9 @@ class PATH
private private
def parse(*paths) def parse(*paths)
paths paths.flatten
.flatten .compact
.flat_map { |p| p.respond_to?(:to_str) ? p.to_str.split(File::PATH_SEPARATOR): p } .flat_map { |p| Pathname.new(p).to_path.split(File::PATH_SEPARATOR) }
.compact .uniq
.map { |p| p.respond_to?(:to_path) ? p.to_path : p.to_str }
.uniq
end end
end end