Sha256: 5b06f20269e53a91e920ff0f84284be09671a62ef8fee53fffcb3c63d8a58c83

Contents?: true

Size: 659 Bytes

Versions: 114

Compression:

Stored size: 659 Bytes

Contents

require 'unf/version'

module UNF
  autoload :Normalizer, 'unf/normalizer'
end

class String
  ascii_only =
    if method_defined?(:ascii_only?)
      'ascii_only?'
    else
      '/[^\x00-\x7f]/ !~ self'
    end

  # :method: to_nfc
  # Converts the string to NFC.

  # :method: to_nfd
  # Converts the string to NFD.

  # :method: to_nfkc
  # Converts the string to NFKC.

  # :method: to_nfkd
  # Converts the string to NFKD.

  [:nfc, :nfd, :nfkc, :nfkd].each { |form|
    eval %{
      def to_#{form.to_s}
        if #{ascii_only}
          self
        else
          UNF::Normalizer.normalize(self, #{form.inspect})
        end
      end
    }
  }
end

Version data entries

114 entries across 86 versions & 14 rubygems

Version Path
direct7-0.0.18 vendor/bundle/ruby/2.7.0/gems/unf-0.1.4/lib/unf.rb
direct7-0.0.17 vendor/bundle/ruby/2.7.0/gems/unf-0.1.4/lib/unf.rb
direct7-0.0.16 vendor/bundle/ruby/2.7.0/gems/unf-0.1.4/lib/unf.rb
direct7-0.0.13 vendor/bundle/ruby/2.7.0/gems/unf-0.1.4/lib/unf.rb
direct7-0.0.12 vendor/bundle/ruby/2.7.0/gems/unf-0.1.4/lib/unf.rb
direct7-0.0.11 vendor/bundle/ruby/2.7.0/gems/unf-0.1.4/lib/unf.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/unf-0.1.4/lib/unf.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.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.rb
paynow_sdk-1.1.0 vendor/cache/ruby/2.7.0/gems/unf-0.1.4/lib/unf.rb
paynow_sdk-1.1.0 vendor/bundle/ruby/2.7.0/gems/unf-0.1.4/lib/unf.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.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.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.rb
paynow_sdk-1.0.9 vendor/cache/ruby/2.7.0/gems/unf-0.1.4/lib/unf.rb
paynow_sdk-1.0.9 vendor/bundle/ruby/2.7.0/gems/unf-0.1.4/lib/unf.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.rb
paynow_sdk-1.0.8 vendor/cache/ruby/2.7.0/gems/unf-0.1.4/lib/unf.rb
paynow_sdk-1.0.8 vendor/bundle/ruby/2.7.0/gems/unf-0.1.4/lib/unf.rb
vagrant-unbundled-2.2.10.0 vendor/bundle/ruby/2.7.0/gems/unf-0.1.4/lib/unf.rb