unf 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +3 -1
- data/lib/unf.rb +12 -0
- data/lib/unf/normalizer.rb +19 -0
- data/lib/unf/normalizer_jruby.rb +1 -1
- data/lib/unf/version.rb +1 -1
- data/unf.gemspec +3 -2
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11e5901eead9bcaba5539ff5368a2196a28a46a0
|
4
|
+
data.tar.gz: 6c63e08825e71783088e591f2a13b71ea4121b21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86c085c9d81908ef33b759d634d5853c43bbdd9c16c722d82add1647c5714edd63dd08e971c526fb17e0d12980ac077c6c6b64e0a6afc1a03b85c155010636ed
|
7
|
+
data.tar.gz: aa66647b11db4497049afa8b8b1a6b9f406b06613d4c35c27ecbe8fff913c7377f632e2596b95349a36a4f4abbce72d6a5729d027983bcd5f5b2f391c245151f
|
data/.travis.yml
CHANGED
data/lib/unf.rb
CHANGED
@@ -12,6 +12,18 @@ class String
|
|
12
12
|
'/[^\x00-\x7f]/ !~ self'
|
13
13
|
end
|
14
14
|
|
15
|
+
# :method: to_nfc
|
16
|
+
# Converts the string to NFC.
|
17
|
+
|
18
|
+
# :method: to_nfd
|
19
|
+
# Converts the string to NFD.
|
20
|
+
|
21
|
+
# :method: to_nfkc
|
22
|
+
# Converts the string to NFKC.
|
23
|
+
|
24
|
+
# :method: to_nfkd
|
25
|
+
# Converts the string to NFKD.
|
26
|
+
|
15
27
|
[:nfc, :nfd, :nfkc, :nfkd].each { |form|
|
16
28
|
eval %{
|
17
29
|
def to_#{form.to_s}
|
data/lib/unf/normalizer.rb
CHANGED
@@ -4,14 +4,33 @@ else
|
|
4
4
|
require 'unf/normalizer_cruby'
|
5
5
|
end
|
6
6
|
|
7
|
+
# UTF-8 string normalizer class. Implementations may vary depending
|
8
|
+
# on the platform.
|
7
9
|
class UNF::Normalizer
|
8
10
|
class << self
|
11
|
+
# :singleton-method: new
|
12
|
+
# :call-seq:
|
13
|
+
# new
|
14
|
+
# instance
|
15
|
+
#
|
16
|
+
# Returns a normalizer instance.
|
17
|
+
|
18
|
+
# :stopdoc:
|
9
19
|
def instance
|
10
20
|
@@normalizer ||= new
|
11
21
|
end
|
22
|
+
# :startdoc:
|
12
23
|
|
24
|
+
# A shortcut for new.normalize(string, form).
|
13
25
|
def normalize(string, form)
|
14
26
|
instance.normalize(string, form)
|
15
27
|
end
|
16
28
|
end
|
29
|
+
|
30
|
+
# :method: normalize
|
31
|
+
# :call-seq:
|
32
|
+
# normalize(string, form)
|
33
|
+
#
|
34
|
+
# Normalizes a UTF-8 string into a given form (:nfc, :nfd, :nfkc or
|
35
|
+
# :nfkd).
|
17
36
|
end
|
data/lib/unf/normalizer_jruby.rb
CHANGED
data/lib/unf/version.rb
CHANGED
data/unf.gemspec
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
require File.expand_path('../lib/unf/version', __FILE__)
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
|
+
gem.name = "unf"
|
6
|
+
gem.version = UNF::VERSION
|
5
7
|
gem.authors = ["Akinori MUSHA"]
|
6
8
|
gem.email = ["knu@idaemons.org"]
|
7
9
|
gem.description = <<-'EOS'
|
@@ -15,9 +17,8 @@ to Ruby/JRuby.
|
|
15
17
|
gem.files = `git ls-files`.split("\n")
|
16
18
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
19
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/.*\.rb})
|
18
|
-
gem.name = "unf"
|
19
20
|
gem.require_paths = ["lib"]
|
20
|
-
gem.
|
21
|
+
gem.extra_rdoc_files = ['README.md', 'LICENSE']
|
21
22
|
|
22
23
|
gem.add_dependency 'unf_ext', '>= 0' unless defined?(JRUBY_VERSION)
|
23
24
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Akinori MUSHA
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-03-
|
11
|
+
date: 2013-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unf_ext
|
@@ -87,7 +87,9 @@ email:
|
|
87
87
|
- knu@idaemons.org
|
88
88
|
executables: []
|
89
89
|
extensions: []
|
90
|
-
extra_rdoc_files:
|
90
|
+
extra_rdoc_files:
|
91
|
+
- README.md
|
92
|
+
- LICENSE
|
91
93
|
files:
|
92
94
|
- .gitignore
|
93
95
|
- .travis.yml
|