Sha256: cc0e8ba6d7d499e014ff642ead59c640cb365143998f4b9112eb105a0c508217
Contents?: true
Size: 608 Bytes
Versions: 118
Compression:
Stored size: 608 Bytes
Contents
require 'java' module UNF # :nodoc: all 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
118 entries across 90 versions & 14 rubygems