Sha256: 3792d7c3bbe1a48e0d9cd06c33e625ad8b72767be2878c82b4cd537d4ebcfc6a

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

# frozen_string_literal: true
# rubocop:disable MethodName

# This file should only be required within JRuby

require "java"
require "utf8_proc"

module UTF8Proc
  module JRuby
    # Module containing JRuby core extension methods for the {::String} class.
    #
    # You can activate this by using:
    #   require "utf8_proc/core_ext/string"
    #
    # It will load either C or Java extensions, depending on your Ruby version.
    module StringExtension
      # @see UTF8Proc::StringExtension#NFC
      def NFC
        ::UTF8Proc.NFC(self)
      end
      alias nfc NFC

      # @see UTF8Proc::StringExtension#NFD
      def NFD
        ::UTF8Proc.NFD(self)
      end
      alias nfd NFD

      # @see UTF8Proc::StringExtension#NFKC
      def NFKC
        ::UTF8Proc.NFKC(self)
      end
      alias nfkc NFKC

      # @see UTF8Proc::StringExtension#NFKD
      def NFKD
        ::UTF8Proc.NFKD(self)
      end
      alias nfkd NFKD

      # @see UTF8Proc::StringExtension#NFKC_CF
      def NFKC_CF
        ::UTF8Proc.NFKC_CF(self)
      end
      alias nfkc_cf NFKC_CF

      # @see UTF8Proc::StringExtension#normalize
      def normalize(form = :nfc)
        ::UTF8Proc.normalize(self, form)
      end
    end
  end
end

String.send(:include, ::UTF8Proc::JRuby::StringExtension)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
utf8_proc-0.6.0 lib/utf8_proc/core_ext/string_jruby.rb