Sha256: 32745a29e8a5921002b0247b7934a4c080d5f46efa750ac34f84e8f34ead6c3e

Contents?: true

Size: 538 Bytes

Versions: 4

Compression:

Stored size: 538 Bytes

Contents

module Unicoder
  module Builder
    class Confusable
      include Builder

      def parse!
        parse_file :confusables, :line, regex: /^(?<from>\S+)\s+;\s+(?<to>.+)\s+;.*$/ do |line|
          source = line["from"].to_i(16)
          if line["to"].include?(" ")
            replace_with = line["to"].split(" ").map{ |codepoint|
              codepoint.to_i(16)
            }
          else
            replace_with = line["to"].to_i(16)
          end
          @index[source] = replace_with
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
unicoder-1.1.1 lib/unicoder/builders/confusable.rb
unicoder-1.1.0 lib/unicoder/builders/confusable.rb
unicoder-1.0.0 lib/unicoder/builders/confusable.rb
unicoder-0.1.0 lib/unicoder/builders/confusable.rb