Sha256: 2acc87ebce3eff72e504bb58db465afc8b1a27bd3a68cbd3fbb8cbd2f6221ea7
Contents?: true
Size: 546 Bytes
Versions: 3
Compression:
Stored size: 546 Bytes
Contents
require_relative "confusable/constants" require 'unicode_normalize/normalize' module Unicode module Confusable def self.confusable?(string1, string2) skeleton(string1) == skeleton(string2) end def self.skeleton(string) require_relative 'confusable/index' unless defined? ::Unicode::Confusable::INDEX UnicodeNormalize.normalize( UnicodeNormalize.normalize(string, :nfd).each_codepoint.map{ |codepoint| INDEX[codepoint] || codepoint }.flatten.pack("U*"), :nfd ) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
unicode-confusable-1.2.0 | lib/unicode/confusable.rb |
unicode-confusable-1.1.0 | lib/unicode/confusable.rb |
unicode-confusable-1.0.1 | lib/unicode/confusable.rb |