README.md in utf8_proc-0.3.0 vs README.md in utf8_proc-0.4.0
- old
+ new
@@ -2,11 +2,11 @@
[![Build Status](https://travis-ci.org/nomoon/utf8_proc.svg?branch=master)](https://travis-ci.org/nomoon/utf8_proc)
[![Dependency Status](https://gemnasium.com/badges/github.com/nomoon/utf8_proc.svg)](https://gemnasium.com/github.com/nomoon/utf8_proc)
[![Gem Version](https://badge.fury.io/rb/utf8_proc.svg)](https://badge.fury.io/rb/utf8_proc)
-A simple wrapper around [utf8proc](https://github.com/JuliaLang/utf8proc) for normalizing Unicode strings. Requires the `utf8proc` library and headers to be installed on your system. *(Packages are available. OSX: `brew install utf8proc`, Linux: `libutf8proc-dev` or `utf8proc-devel`)*
+A simple wrapper around [utf8proc](https://github.com/JuliaLang/utf8proc) for normalizing Unicode strings. Will use the `utf8proc` shared library and headers installed on your system if they are available *(Packages are available. OSX: `brew install utf8proc`, Linux: `libutf8proc-dev` or `utf8proc-devel`)*. Failing that, it will fall-back to compiling the library into the extension.
Currently supports UTF-8/ASCII string input and NFC, NFD, NFKC, NFKD, and NKFC-Casefold forms. Handles Unicode 9.0 and includes the current official full suite of 9.0 normalization tests.
Quick benchmarks against the [UNF](https://github.com/knu/ruby-unf) gem show it to be between the same speed (best-case) and ~2x slower (worst-case), averaging about ~1.2x slower on complex Unicode strings. The speed difference is more equal in NFC/NFD modes where mostly or already-normalized strings are used.
@@ -15,11 +15,11 @@
## Installation
Add this line to your application's Gemfile:
```ruby
-gem 'utf8_proc'
+gem "utf8_proc"
```
And then execute:
$ bundle
@@ -51,9 +51,17 @@
# Second argument may be any of: [:nfc (default), :nfd, :nfkc, :nfkd, :nfkc_cf]
UTF8Proc.normalize(utf8_string, form = :nfc)
# Version string of loaded libutf8proc
UTF8Proc::LIBRARY_VERSION
+
+# Add normalization methods directly to String class
+require "utf8_proc/core_ext/string"
+
+# This enables:
+"String".NFC
+"String".normalize(:nfc)
+
```
(Like `unf`) on JRuby the gem will fall-back to using `java.text.normalizer`. The interface remains the same.
## Contributing