Module: Files::PathUtil
- Defined in:
- lib/files.com/path_util.rb
Constant Summary collapse
- TRANSLIT_MAP =
"ÀA,ÁA,ÂA,ÃA,ÄA,ÅA,ÆAE,ÇC,ÈE,ÉE,ÊE,ËE,ÌI,ÍI,ÎI,ÏI,ÐD,ÑN,ÒO,ÓO,ÔO,ÕO,ÖO,ØO,ÙU,ÚU,ÛU,ÜU,ÝY,ßss,àa,áa,âa,ãa,äa,åa,æae,çc,èe,ée,êe,ëe,ìi,íi,îi,ïi,ðd,ñn,òo,óo,ôo,õo,öo,øo,ùu,úu,ûu,üu,ýy,ÿy,ĀA,āa,ĂA,ăa,ĄA,ąa,ĆC,ćc,ĈC,ĉc,ĊC,ċc,ČC,čc,ĎD,ďd,ĐD,đd,ĒE,ēe,ĔE,ĕe,ĖE,ėe,ĘE,ęe,ĚE,ěe,ĜG,ĝg,ĞG,ğg,ĠG,ġg,ĢG,ģg,ĤH,ĥh,ĦH,ħh,ĨI,ĩi,ĪI,īi,ĬI,ĭi,ĮI,įi,İI,IJIJ,ijij,ĴJ,ĵj,ĶK,ķk,ĹL,ĺl,ĻL,ļl,ĽL,ľl,ŁL,łl,ŃN,ńn,ŅN,ņn,ŇN,ňn,ʼn'n,ŌO,ōo,ŎO,ŏo,ŐO,őo,ŒOE,œoe,ŔR,ŕr,ŖR,ŗr,ŘR,řr,ŚS,śs,ŜS,ŝs,ŞS,şs,ŠS,šs,ŢT,ţt,ŤT,ťt,ŨU,ũu,ŪU,ūu,ŬU,ŭu,ŮU,ůu,ŰU,űu,ŲU,ųu,ŴW,ŵw,ŶY,ŷy,ŸY,ŹZ,źz,ŻZ,żz,ŽZ,žz".split(",").to_h { |val| [ val[0], val[1..2] ] }.freeze
Class Method Summary collapse
Class Method Details
.cleanpath(path) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/files.com/path_util.rb', line 15 def self.cleanpath(path) new_path = Pathname.new(path).cleanpath.to_s return "" if [ ".", ".." ].include? new_path return new_path[1..] if new_path.index('/') == 0 new_path end |
.normalize_for_comparison(*args) ⇒ Object
7 8 9 |
# File 'lib/files.com/path_util.rb', line 7 def self.normalize_for_comparison(*args) unicode_normalize_and_transliterate(normalize(*args).to_s).downcase.rstrip end |
.same?(a, b) ⇒ Boolean
11 12 13 |
# File 'lib/files.com/path_util.rb', line 11 def self.same?(a, b) normalize_for_comparison(a) == normalize_for_comparison(b) end |