cbeta 4.2.0 → 4.3.0
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
- checksums.yaml.gz.sig +0 -0
- data/lib/cbeta/gaiji.rb +16 -2
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d87e5abf202e1a364780efea5d54761eef5a59c19ff68b17e051fdd119f0baa5
|
|
4
|
+
data.tar.gz: c1720705f1a5beabb8267568baab667973e722321a41c2b5139063f203289f04
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9cf1756da5884ecb2414981f99fdabede3d7bc511b9002d62d5f9581bbe9232b037409dc6c361771eded7a5edb1cb3e720ce91cc0ceddf6060a50ea274e679fa
|
|
7
|
+
data.tar.gz: f8854526080b42a3e53e52f8b775afeaed21cd2a9a66c35947a71c0b2a7551d6860e03c1cca92f4e19f43b20c617ebf80a1a54d20750cdfe42d7c9d2fdcd90b1
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/lib/cbeta/gaiji.rb
CHANGED
|
@@ -5,6 +5,15 @@ class CBETA::Gaiji
|
|
|
5
5
|
# 內建缺字資料所在的資料夾
|
|
6
6
|
DATA_FOLDER = File.expand_path('../data', __dir__)
|
|
7
7
|
|
|
8
|
+
# 內建缺字資料的期別(CBETA 釋出版本)
|
|
9
|
+
DATA_VERSION = '2026.R2'
|
|
10
|
+
|
|
11
|
+
# 缺字資料的期別。使用內建資料時為 {DATA_VERSION};
|
|
12
|
+
# 使用外部資料時為呼叫者傳入的 data_version,未傳入則為 nil。
|
|
13
|
+
#
|
|
14
|
+
# @return [String, nil]
|
|
15
|
+
attr_reader :data_version
|
|
16
|
+
|
|
8
17
|
# 載入 CBETA 缺字資料庫
|
|
9
18
|
#
|
|
10
19
|
# 預設使用 gem 內建的缺字資料。也可以傳入外部檔案路徑,自行決定要使用哪一份資料,
|
|
@@ -13,6 +22,8 @@ class CBETA::Gaiji
|
|
|
13
22
|
#
|
|
14
23
|
# @param gaiji_path [String, nil] CB 缺字資料(cbeta_gaiji.json)路徑,nil 表示使用內建資料
|
|
15
24
|
# @param sanskrit_path [String, nil] 悉曇、蘭札資料(cbeta_sanskrit.json)路徑,nil 表示使用內建資料
|
|
25
|
+
# @param data_version [String, nil] 外部缺字資料的期別,供 {#data_version} 回傳;
|
|
26
|
+
# gaiji_path、sanskrit_path 都未指定時忽略此參數,一律為 {DATA_VERSION}
|
|
16
27
|
#
|
|
17
28
|
# @example 使用內建資料
|
|
18
29
|
# g = CBETA::Gaiji.new
|
|
@@ -20,10 +31,13 @@ class CBETA::Gaiji
|
|
|
20
31
|
# @example 使用外部資料
|
|
21
32
|
# g = CBETA::Gaiji.new(
|
|
22
33
|
# gaiji_path: '/path/to/cbeta_gaiji/cbeta_gaiji.json',
|
|
23
|
-
# sanskrit_path: '/path/to/cbeta_gaiji/cbeta_sanskrit.json'
|
|
34
|
+
# sanskrit_path: '/path/to/cbeta_gaiji/cbeta_sanskrit.json',
|
|
35
|
+
# data_version: '2026.R3'
|
|
24
36
|
# )
|
|
25
|
-
def initialize(gaiji_path: nil, sanskrit_path: nil)
|
|
37
|
+
def initialize(gaiji_path: nil, sanskrit_path: nil, data_version: nil)
|
|
26
38
|
@us = CBETA::UnicodeService.new
|
|
39
|
+
builtin = gaiji_path.nil? && sanskrit_path.nil?
|
|
40
|
+
@data_version = builtin ? DATA_VERSION : data_version
|
|
27
41
|
gaiji_path ||= File.join(DATA_FOLDER, 'cbeta_gaiji.json')
|
|
28
42
|
sanskrit_path ||= File.join(DATA_FOLDER, 'cbeta_sanskrit.json')
|
|
29
43
|
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
|
Binary file
|