Sha256: 1d8922171775830a25775e285a80f1443ae447f6efd96197cb8fb5f0838449b5

Contents?: true

Size: 420 Bytes

Versions: 2

Compression:

Stored size: 420 Bytes

Contents

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

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

  [: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

2 entries across 2 versions & 2 rubygems

Version Path
domo-0.0.5 vendor/bundle/ruby/1.9.1/gems/unf-0.0.4/lib/unf.rb
unf-0.0.4 lib/unf.rb