Method: Unicode::Name.correct

Defined in:
lib/unicode/name.rb

.correct(char) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/unicode/name.rb', line 26

def self.correct(char)
  codepoint = char.unpack("U")[0]
  require_relative "name/index" unless defined? ::Unicode::Name::INDEX
  if correction = INDEX[:ALIASES][codepoint] &&
                  INDEX[:ALIASES][codepoint][:correction] &&
                  INDEX[:ALIASES][codepoint][:correction][-1]
    correction
  else
    unicode_name(char)
  end
end