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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e86b3e6256a56e239bd95259c3e040ce05563740aa7a53ae387bbdace4bae2e1
4
- data.tar.gz: d72162f4ea8d9c0650d748b3593c3ddabe259dd295438d7aed7a474b93bfe5bf
3
+ metadata.gz: d87e5abf202e1a364780efea5d54761eef5a59c19ff68b17e051fdd119f0baa5
4
+ data.tar.gz: c1720705f1a5beabb8267568baab667973e722321a41c2b5139063f203289f04
5
5
  SHA512:
6
- metadata.gz: e75dbd36ac5ececb236bac18deff9692055188456cc42afe69a99218948013943229e5f3679272491c9ff6baaac0f06654a2f1ff9965df0bb2dbff3b9d048d45
7
- data.tar.gz: 644492039267b108f6d35fdf97fb937bbff1ce592d2090169171a89d94aa235e59068eb1dc92fb6ca3c10fd1afa4c0c6a8e48c87c29fff9b49fe05431ecdf4e1
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
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cbeta
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.0
4
+ version: 4.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ray Chou
metadata.gz.sig CHANGED
Binary file