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

Version Path
direct7-0.0.18 vendor/bundle/ruby/2.7.0/gems/unf-0.1.4/lib/unf/normalizer_jruby.rb
direct7-0.0.17 vendor/bundle/ruby/2.7.0/gems/unf-0.1.4/lib/unf/normalizer_jruby.rb
direct7-0.0.16 vendor/bundle/ruby/2.7.0/gems/unf-0.1.4/lib/unf/normalizer_jruby.rb
unf-0.2.0-java lib/unf/normalizer_jruby.rb
unf-0.2.0 lib/unf/normalizer_jruby.rb
direct7-0.0.13 vendor/bundle/ruby/2.7.0/gems/unf-0.1.4/lib/unf/normalizer_jruby.rb
direct7-0.0.12 vendor/bundle/ruby/2.7.0/gems/unf-0.1.4/lib/unf/normalizer_jruby.rb
direct7-0.0.11 vendor/bundle/ruby/2.7.0/gems/unf-0.1.4/lib/unf/normalizer_jruby.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/unf-0.1.4/lib/unf/normalizer_jruby.rb
paynow_sdk-1.1.0 vendor/cache/ruby/2.7.0/gems/paynow_sdk-1.0.0/vendor/cache/ruby/2.7.0/gems/unf-0.1.4/lib/unf/normalizer_jruby.rb
paynow_sdk-1.1.0 vendor/bundle/ruby/2.7.0/gems/paynow_sdk-1.0.9/vendor/bundle/ruby/2.7.0/gems/unf-0.1.4/lib/unf/normalizer_jruby.rb
paynow_sdk-1.1.0 vendor/bundle/ruby/2.7.0/gems/paynow_sdk-1.0.9/vendor/cache/ruby/2.7.0/gems/unf-0.1.4/lib/unf/normalizer_jruby.rb
paynow_sdk-1.1.0 vendor/bundle/ruby/2.7.0/gems/unf-0.1.4/lib/unf/normalizer_jruby.rb
paynow_sdk-1.1.0 vendor/cache/ruby/2.7.0/gems/unf-0.1.4/lib/unf/normalizer_jruby.rb
paynow_sdk-1.1.0 vendor/bundle/ruby/2.7.0/gems/paynow_sdk-1.0.9/vendor/cache/ruby/2.7.0/gems/paynow_sdk-1.0.0/vendor/cache/ruby/2.7.0/gems/unf-0.1.4/lib/unf/normalizer_jruby.rb
paynow_sdk-1.0.9 vendor/cache/ruby/2.7.0/gems/paynow_sdk-1.0.0/vendor/cache/ruby/2.7.0/gems/unf-0.1.4/lib/unf/normalizer_jruby.rb
paynow_sdk-1.0.9 vendor/bundle/ruby/2.7.0/gems/unf-0.1.4/lib/unf/normalizer_jruby.rb
paynow_sdk-1.0.9 vendor/cache/ruby/2.7.0/gems/unf-0.1.4/lib/unf/normalizer_jruby.rb
paynow_sdk-1.0.8 vendor/cache/ruby/2.7.0/gems/paynow_sdk-1.0.0/vendor/cache/ruby/2.7.0/gems/unf-0.1.4/lib/unf/normalizer_jruby.rb
paynow_sdk-1.0.8 vendor/cache/ruby/2.7.0/gems/unf-0.1.4/lib/unf/normalizer_jruby.rb