module Kirillica::ISO_9

Constants

TABLE
WINDOW

Public Class Methods

revert!(phrase) click to toggle source

invert transliteration

# File lib/kirillica/iso_9.rb, line 55
def self.revert!(phrase)
  reverted_phrase = ''

  phrase.each_char do |char|
    reverted_char = TABLE.invert[char]
    raise 'cannot revert phrase' unless reverted_char

    reverted_phrase << reverted_char
  end

  reverted_phrase
end
translit(phrase='') click to toggle source

transliteration

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

  phrase.each_char do |char|
    translitted_char = TABLE[char]
    translitted_phrase << (translitted_char.nil? ? char : translitted_char)
  end

  translitted_phrase
end