Class: Prekladatelj::Cyrillic

Inherits:
Object
  • Object
show all
Defined in:
lib/prekladatelj.rb

Overview

class Preferences

  @preferences = {}

  # @param [Hash] prefs
  def self.define(prefs)
    @preferences = prefs if prefs.kind_of? Hash
  end

  def self.preferences=(prefs)
    define prefs
  end

  def self.preferences
    @preferences
  end

end

Constant Summary collapse

UPPER =
%w[А Б Ц Ч Д Е Є Ф Г Х И Ј К Л Љ М Н Њ О П Р С Ш Т У В Ы З Ж]
DOWN =
%w[а б ц ч д е є ф г х и ј к л љ м н њ о п р с ш т у в ы з ж]

Class Method Summary collapse

Class Method Details

.to_latin(line, *args) ⇒ Object

Parameters:



43
44
45
46
47
48
49
50
# File 'lib/prekladatelj.rb', line 43

def self.to_latin(line, *args)
  str = String line[0..-1]

  UPPER.each { |x| str.gsub! x, Latin::UPPER[UPPER.index(x)] if UPPER.any? x}
  DOWN.each { |x| str.gsub! x, Latin::DOWN[DOWN.index(x)] if DOWN.any? x}

  str
end