module AnyAscii
Constants
- BLOCKS
Public Class Methods
transliterate(string)
click to toggle source
# File lib/any_ascii.rb, line 21 def self.transliterate(string) if string.ascii_only? return string end result = '' string.each_codepoint do |cp| if cp <= 127 result << cp else block_num = cp >> 8 lo = cp & 0xff block = BLOCKS[block_num] if block.length > lo result << block[lo] end end end return result end