Russian transliteration
Транслитерация для букв русского алфавита
Transliteration heavily based on rutils gem by Julian "julik" Tarkhanov and Co. <rutils.rubyforge.org/> Cleaned up and optimized.
Transliterate a string with russian characters
Возвращает строку, в которой все буквы русского алфавита заменены на похожую по звучанию латиницу
# File lib/russian/transliteration.rb, line 50 def transliterate(str) chars = str.scan(%{#{MULTI_KEYS.join '|'}|\w|.}) result = "" chars.each_with_index do |char, index| if UPPER.has_key?(char) && LOWER.has_key?(chars[index+1]) # combined case result << UPPER[char].downcase.capitalize elsif UPPER.has_key?(char) result << UPPER[char] elsif LOWER.has_key?(char) result << LOWER[char] else result << char end end result end
Generated with the Darkfish Rdoc Generator 2.