Module: ODDB::UmlautSort

Included in:
State::Global, View::Companies::CompanyList, View::Hospitals::HospitalList
Defined in:
src/util/umlautsort.rb

Constant Summary

FILTER_PAIRS =
[
  [/[ÅÁÂÀÃĄǍĂĀȦåáâàãąǎăāȧ]/u, 'a'], [/[Ḃḃ]/u, 'b'], [/[ÇĈČĆĊçĉčćċ]/u, 'c'],
  [/[ḐĐÐĎḊḑđðďḋ]/u, 'd'], [/[ËÉÊÈȨĘĚĔẼĒĖëéêèȩęěĕẽēė]/u, 'e'],
  [/[ÞḞþḟ]/u, 'f'], [/[ĢǦĞǴĜḠĠģǧğǵĝḡġ]/u, 'g'], [/[ȞĤḦḨḢȟĥḧḩḣ]/u, 'h'],
  [/[ÏÍÎÌĮǏĬĨİïíîìįǐĭĩı]/u, 'i'], [/[Ĵĵ]/u, 'j'], [/[ǨḰĶǩḱķ]/u, 'k'],
  [/[ŁĹĽĻłĺľļ]/u, 'l'], [/[ḾṀḿṁ]/u, 'm'], [/[ŇŃÑǸŅṄňńñǹņṅ]/u, 'n'],
  [/[ÓÔÒÕŌŎǪǑȮóôòõōŏøǫǒȯ]/u, 'o'], [/[ṔṖṕṗ]/u, 'p'], [/[ŘŔŖṘřŕŗṙ]/u, 'r'],
  [/[ŚŜŠŞṠśŝšşṡ]/u, 's'], [/[ŤŢṪťţṫ]/u, 't'],
  [/[ÚÛÙŲǗǓǙǛŨŬŮǕúûùųǘǔǚǜũŭůǖ]/u, 'u'], [/[Ṽṽ]/u, 'v'],
  [/[ẂŴẀẄẆẃŵẁẅẇ]/u, 'w'], [/[ẌẊẍẋ]/u, 'x'], [/[ŸẎỸỲŶÝȲÿẏỹỳŷýȳ]/u, 'y'],
  [/[ŽŹẐŻžźẑż]/u, 'z']
]

Instance Method Summary (collapse)

Instance Method Details

- (Object) sort_model



18
19
20
21
22
23
24
# File 'src/util/umlautsort.rb', line 18

def sort_model
  if(self::class::SORT_DEFAULT && (@session.event != :sort))
    @model = @model.sort_by { |item| 
      umlaut_filter(item.send(self::class::SORT_DEFAULT))
    } 
  end
end

- (Object) umlaut_filter(itm)



25
26
27
28
29
30
31
32
33
34
35
# File 'src/util/umlautsort.rb', line 25

def umlaut_filter(itm)
  if itm.kind_of? String
    itm = itm.downcase
    FILTER_PAIRS.each do |search, replace|
      itm.gsub! search, replace
    end
    itm
  else
    itm
  end
end