module Myasorubka::Unicode

This module provides downcase and upcase methods designed for Russian. The original code is written by Andrew Kozlov for the Petrovich library.

github.com/petrovich/petrovich-ruby/blob/df705075542979ab85e1f2bf9a2024b1c0813e1a/lib/petrovich/unicode.rb

Constants

RU_LOWERCASE

Russian small letters.

RU_UPPERCASE

Russian capital letters.

Public Instance Methods

downcase(string) click to toggle source

Returns a copy of the given string having replaced capital Russian letters with small ones.

@param string [String] a string. @return [String] a new string.

# File lib/myasorubka/unicode.rb, line 33
def downcase(string)
  string.tr(RU_UPPERCASE, RU_LOWERCASE).tap(&:downcase!)
end
upcase(string) click to toggle source

Returns a copy of the given string having replaced small Russian letters with capital ones.

@param string [String] a string. @return [String] a new string.

# File lib/myasorubka/unicode.rb, line 43
def upcase(string)
  string.tr(RU_LOWERCASE, RU_UPPERCASE).tap(&:upcase!)
end