module Kirillica::UsaGovernment

Constants

TABLE
WINDOW

Public Class Methods

revert!(phrase) click to toggle source

invert transliteration

# File lib/kirillica/usa_government.rb, line 64
def self.revert!(phrase)
  raise 'cannot revert phrase'
end
translit(phrase='') click to toggle source

transliteration

# File lib/kirillica/usa_government.rb, line 42
def self.translit(phrase='')
  return '' if phrase.empty?
  translitted_phrase = ''

  phrase.each_char.with_index(1) do |char, i|
    if TABLE[char].nil?
      translitted_phrase << char
    elsif ['ะต', 'ั‘'].include?(char)
      if 1 == i || ['ัŠ', 'ัŒ'].include?(phrase[i - 1])
        translitted_phrase << 'ye'
      else
        translitted_phrase << 'e'
      end
    else
      translitted_phrase << TABLE[char]
    end
  end

  translitted_phrase
end