module RailsI18n::Transliteration::Ukrainian
def rule
def rule lambda do |string| next '' unless string string.gsub(/./) do |char| # Regexp.last_match is local to the thread and method scope # of the method that did the pattern match. @pre_match, @post_match = $`, $' case char when 'Ж' lookahead_upcase 'ZH' when 'Х' lookahead_upcase 'KH' when 'Ц' lookahead_upcase 'TS' when 'Ч' lookahead_upcase 'CH' when 'Ш' lookahead_upcase 'SH' when 'Щ' lookahead_upcase 'SHCH' when 'г' behind =~ /[зЗ]/ ? 'gh' : 'h' when 'Г' behind =~ /[зЗ]/ ? lookahead_upcase('GH') : 'H' when 'є' letter?(behind) ? 'ie' : 'ye' when 'Є' letter?(behind) ? lookahead_upcase('IE') : lookahead_upcase('YE') when 'ї' letter?(behind) ? 'i' : 'yi' when 'Ї' letter?(behind) ? 'I' : lookahead_upcase('YI') when 'й' letter?(behind) ? 'i' : 'y' when 'Й' letter?(behind) ? 'I' : 'Y' when 'ю' letter?(behind) ? 'iu' : 'yu' when 'Ю' letter?(behind) ? lookahead_upcase('IU') : lookahead_upcase('YU') when 'я' letter?(behind) ? 'ia' : 'ya' when 'Я' letter?(behind) ? lookahead_upcase('IA') : lookahead_upcase('YA') when "'" # remove apostrophe inside a word letter?(behind) && letter?(ahead) ? '' : "'" else straight_lookup[char] || char end end end end