Class: File
Class Method Summary collapse
-
.equivalent?(a, b) ⇒ Boolean
gives true if one of the paths is the ending of another path.
Class Method Details
.equivalent?(a, b) ⇒ Boolean
17 18 19 20 21 22 23 |
# File 'lib/sitefuel/extensions/FileComparison.rb', line 17 def self.equivalent?(a, b) list = [ File.(a, '/').split(File::SEPARATOR)[1 .. -1], File.(b, '/').split(File::SEPARATOR)[1 .. -1] ].sort {|l,r| l.length <=> r.length }.reverse list.first.ends_with? list.last end |