aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--lib/unicode_normalize.rb22
2 files changed, 28 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index b769ace274..4e03b531e8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Sun Oct 19 10:04:04 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
+
+ * lib/unicode_normalize.rb: Importing from
+ https://github.com/duerst/eprun/blob/master/lib/string_normalize.rb.
+ (removing trailing whitespace, fixing EOLs and adding EOL property)
+
Sun Oct 19 09:56:56 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
* tool/unicode_norm_gen.rb: Changed module name.
diff --git a/lib/unicode_normalize.rb b/lib/unicode_normalize.rb
new file mode 100644
index 0000000000..a1a1149d72
--- /dev/null
+++ b/lib/unicode_normalize.rb
@@ -0,0 +1,22 @@
+# coding: utf-8
+
+# Copyright 2010-2013 Ayumu Nojima (野島 歩) and Martin J. Dürst (duerst@it.aoyama.ac.jp)
+# available under the same licence as Ruby itself
+# (see http://www.ruby-lang.org/en/LICENSE.txt)
+
+require File.dirname(__FILE__) + '/normalize'
+
+class String
+ def normalize(form = :nfc)
+ Normalize.normalize(self, form)
+ end
+
+ def normalize!(form = :nfc)
+ replace(self.normalize(form))
+ end
+
+ def normalized?(form = :nfc)
+ Normalize.normalized?(self, form)
+ end
+end
+