Sha256: e2e769bc4d43d287bb20bd9abc3a56b82d79c8ce31f724b12ebed29d153cfb8c
Contents?: true
Size: 594 Bytes
Versions: 11
Compression:
Stored size: 594 Bytes
Contents
require 'java' module UNF class Normalizer def initialize() @normalizer = java.text.Normalizer end def normalize(string, normalization_form) @normalizer.normalize(string, form(normalization_form)) end private def form(symbol) case symbol when :nfc @normalizer::Form::NFC when :nfd @normalizer::Form::NFD when :nfkc @normalizer::Form::NFKC when :nfkd @normalizer::Form::NFKD else raise ArgumentError, "unknown normalization form: #{symbol.inspect}" end end end end
Version data entries
11 entries across 11 versions & 3 rubygems