Sha256: e8156017441286e953089128640f285f008a02f6609e85d3fcd942a008e6179c
Contents?: true
Size: 771 Bytes
Versions: 4
Compression:
Stored size: 771 Bytes
Contents
# encoding: utf-8 module Corrector # Converts string to uppercase and its latin letters to cyrillic ones. class Cyrillic < String # The source line for conversion. # # @example # str = Cyrillic.new "mapc" # => "МАРС" # str.source # => "mapc" # attr_reader :source # Converts letters in the source string to uppercase cyrillic ones. # # @example # Cyrillic.new "mapka" # => "МАРКА" # # Params: # +value+:: The source string to be converted. # # Returns a converted string. def initialize(value) @source = value super line end private def line source.to_s.mb_chars.upcase.tr("ABCDEHKMNOPTXY", "АВСДЕНКМ№ОРТХУ") end end end
Version data entries
4 entries across 4 versions & 1 rubygems