unihan2 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +5 -5
  2. data/lib/unihan2.rb +68 -0
  3. metadata +3 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: fae40954138f855d868c2da82c7d2974bd494b23
4
- data.tar.gz: 5ec39c9d749eb1a5e84807539853d1e5e8fe0d08
2
+ SHA256:
3
+ metadata.gz: bdca2031f4b271b10f7e955fac3a1f74df5ccbd0d9ed7f731b5b6469a6b80280
4
+ data.tar.gz: d9e0d288ec3380057b1680c1e6bc4c36375a155f05a6dad6ea8c8266882665ed
5
5
  SHA512:
6
- metadata.gz: fda3134caa396c7523a2e9d9d265fd842776aa831050481a93dc4a33be2e47e27f304d2288831a1e4ad7bffbb3a80e5ad0a80209354871a083748b6729de65a1
7
- data.tar.gz: 102fcab8c21dba8be7182c80b214ab23c90f3925a7a8d2dae0dce9b07e39478d8641fc1bceaba745986ba5176b127bdae34c1b4598d1ff4d31c975876136a623
6
+ metadata.gz: b77a5a7d65066e30e144643a4e39790ee91c35f51f3a38d7993d5cd8c57d0000a49afe119b0a30a50fde03172218dc87beda7fc0993ae6b0136e05db9ed730b3
7
+ data.tar.gz: b30b2d5f59c3e09733708f71604bcfbebb1c3e3a59956ad93e12268c2aa6b287781369bf52007821dae70e552cc59a476fdfeae4e00f390e1a128ca19a3a5fe6
@@ -16,10 +16,78 @@ class Unihan2
16
16
  end
17
17
  end
18
18
 
19
+ def self.unicode_version(code)
20
+ if code.is_a? Integer
21
+ i = code
22
+ else
23
+ i = code.hex
24
+ end
25
+
26
+ if i < 0xF000
27
+ case i
28
+ when 0x3400..0x4DB5 # Unicode 3.0: Extension A
29
+ 3.0
30
+ when 0x4DB6..0x4DBF # Unicode 13.0: Extension A
31
+ 13.0
32
+ when 0x4E00..0x9FA5 # CJK Unified Ideographs
33
+ 1.1
34
+ when 0x9FA6..0x9FBB # CJK Unified Ideographs
35
+ 4.1
36
+ when 0x9FBC..0x9FC3 # CJK Unified Ideographs
37
+ 5.1
38
+ when 0x9FC4..0x9FCB # CJK Unified Ideographs
39
+ 5.2
40
+ when 0x9FCC # CJK Unified Ideographs
41
+ 6.1
42
+ when 0x9FCD..0x9FD5 # CJK Unified Ideographs
43
+ 8.0
44
+ when 0x9FD6..0x9FEA # CJK Unified Ideographs
45
+ 10.0
46
+ when 0x9FEB..0x9FEF # CJK Unified Ideographs
47
+ 11.0
48
+ when 0x9FF0..0x9FFC # CJK Unified Ideographs
49
+ 13.0
50
+ end
51
+ elsif i < 0x20000
52
+ case i
53
+ when 0xF900..0xFA2D # CJK Compatibility Ideographs
54
+ 1.1
55
+ when 0xFA2E..0xFA2F # CJK Compatibility Ideographs
56
+ 6.1
57
+ when 0xFA30..0xFA6A # CJK Compatibility Ideographs
58
+ 3.2
59
+ when 0xFA6B..0xFA6D # CJK Compatibility Ideographs
60
+ 5.2
61
+ when 0xFA70..0xFAD9 # CJK Compatibility Ideographs
62
+ 4.1
63
+ end
64
+ else
65
+ case i
66
+ when 0x20000..0x2A6D6 # Extension B
67
+ 3.1
68
+ when 0x2A6D7..0x2A6DD # Extension B
69
+ 13.0
70
+ when 0x2A700..0x2B734 # extension C
71
+ 5.2
72
+ when 0x2B740..0x2B81D # extension D
73
+ 6.0
74
+ when 0x2B820..0x2CEA1 # extension E
75
+ 8.0
76
+ when 0x2CEB0..0x2EBE0 # extension F
77
+ 10.0
78
+ when 0x2F800..0x2FA1D # Unicode 3.1: CJK Compatibility Supplement
79
+ 3.1
80
+ when 0x30000..0x3134A # extension G
81
+ 13.0
82
+ end
83
+ end
84
+ end
85
+
19
86
  # return total strokes of the character char
20
87
  # @param char [String] the character
21
88
  # @return [Integer] the total strokes
22
89
  def strokes(char)
23
90
  @strokes[char]
24
91
  end
92
+
25
93
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unihan2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ray Chou
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-28 00:00:00.000000000 Z
11
+ date: 2020-12-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Unihan Database Utilities
14
14
  email: zhoubx@gmail.com
@@ -37,8 +37,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
37
37
  - !ruby/object:Gem::Version
38
38
  version: '0'
39
39
  requirements: []
40
- rubyforge_project:
41
- rubygems_version: 2.4.8
40
+ rubygems_version: 3.1.4
42
41
  signing_key:
43
42
  specification_version: 4
44
43
  summary: Chinese