module Tr39Confusables
Public Class Methods
is_confusable?(a, b)
click to toggle source
# File lib/tr39_confusables.rb, line 11 def self.is_confusable?(a, b) skeleton(a) == skeleton(b) end
skeleton(string)
click to toggle source
# File lib/tr39_confusables.rb, line 6 def self.skeleton(string) string = UNF::Normalizer.normalize(string, :nfc) UNF::Normalizer.normalize(mapping(string), :nfc) end
Private Class Methods
mapping(string)
click to toggle source
# File lib/tr39_confusables.rb, line 17 def self.mapping(string) string.chars.map { |c| @@table.fetch(c, c) }.join end