cbeta 2.7.1 → 2.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cbeta/gaiji.rb +34 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42dbfbde16fb266a235ecf8b39f0dac386bc6292ddcf30ae1ea8c00d0de0ecd2
|
4
|
+
data.tar.gz: 9ee9b0c20d150076b43e58e31590698ec0b132e40bccc87544c6cdae982cf5e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 630eb89aa2076cb0cb8a0eebd27885d29ae93c33d006fc7e44a9844c3a1677fe4be3d4aa9e1688eae9d99785d4feaad2bda41390d32d0a908dbb2fa1a63e37c5
|
7
|
+
data.tar.gz: 12c28ab7267f5f3bf00382c85e6beae76ffcea2ef1297fa1ca7b7fe84dbc87a69de81476d38081609c7a13937c15a696c13b9f97dd25be97eb7c2f32696a4e6d
|
data/lib/cbeta/gaiji.rb
CHANGED
@@ -53,6 +53,40 @@ class CBETA::Gaiji
|
|
53
53
|
@gaijis.key? cb
|
54
54
|
end
|
55
55
|
|
56
|
+
def to_s(gid, cb_priority=nil, skt_priority=nil)
|
57
|
+
if cb_priority.nil?
|
58
|
+
cb_priority = %w(uni_char norm_uni_char norm_big5_char composition)
|
59
|
+
end
|
60
|
+
|
61
|
+
if skt_priority.nil?
|
62
|
+
skt_priority = %w(symbol romanized PUA)
|
63
|
+
end
|
64
|
+
|
65
|
+
g = @gaijis[gid]
|
66
|
+
if gid.start_with? 'CB'
|
67
|
+
cb_priority.each do |k|
|
68
|
+
if k == 'PUA'
|
69
|
+
return CBETA.pua(gid)
|
70
|
+
elsif g.key? k
|
71
|
+
return g[k] unless g[k].empty?
|
72
|
+
end
|
73
|
+
end
|
74
|
+
else
|
75
|
+
skt_priority.each do |k|
|
76
|
+
if k == 'PUA'
|
77
|
+
s = g['pua'].sub(/^U\+(.*)$/, '\1')
|
78
|
+
i = s.to_i(16)
|
79
|
+
return [i].pack("U")
|
80
|
+
else
|
81
|
+
if g.key? k
|
82
|
+
return g[k] unless g[k].empty?
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
nil
|
88
|
+
end
|
89
|
+
|
56
90
|
def unicode_to_cb(unicode_char)
|
57
91
|
@uni2cb[unicode_char]
|
58
92
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cbeta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.7.
|
4
|
+
version: 2.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ray Chou
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ruby gem for use Chinese Buddhist Text resources made by CBETA (http://www.cbeta.org).
|
14
14
|
email: zhoubx@gmail.com
|