module Nuggets::I18n

Constants

DIACRITICS

Public Class Methods

args_for_map_diacritics() click to toggle source
# File lib/nuggets/i18n.rb, line 96
def self.args_for_map_diacritics
  @args_for_map_diacritics ||= begin
    map = ::Hash.new { |h, k| h[k] = [] }

    DIACRITICS.each { |a| a.each { |i| map[i].concat(a) } }
    map.each { |k, v| v.uniq!; map[k] = "(#{::Regexp.union(*v).source})" }

    [::Regexp.union(*map.keys.sort_by { |k| -k.length }), map.method(:[])]
  end
end