class Prekladatelj::Latin
Constants
- DOWN
- EASTERN
- UPPER
Public Class Methods
to_cyrillic(line, *args)
click to toggle source
@param [String] line
# File lib/prekladatelj.rb, line 87 def self.to_cyrillic(line, *args) str = String line[0..-1] if args.any? :eastern line = Helper::smart_split str line.each do |word| while word =~ /[eě](je)/ word["eje"] = "ее" if word.include? 'eje' word["ěje"] = "єе" if word.include? 'ěje' end while word =~ /[^aiueoyj](je)/ word["je"] = "ье" end while word =~ /(ji)/ word["ji"] = "и" end word["je"] = "е" if word.start_with? "je" word["se"] = "ся" if word.gsub(/\W+/, '') == "se" while word =~ /[^aiueoyj](je)/ word["je"] = "ье" end end str = line.join "" EASTERN.each_pair do |k, v| str.gsub! k, v str.gsub! k.capitalize, v.capitalize str.gsub! k.upcase, v.upcase end end UPPER.each { |x| str.gsub! x, Cyrillic::UPPER[UPPER.index(x)] if UPPER.any? x} DOWN.each { |x| str.gsub! x, Cyrillic::DOWN[DOWN.index(x)] if DOWN.any? x} str end