unicode-scripts 1.12.0 → 1.13.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
- data/.rake_tasks +3 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +2 -1
- data/Gemfile.lock +31 -13
- data/MIT-LICENSE.txt +1 -1
- data/README.md +2 -4
- data/data/scripts.marshal.gz +0 -0
- data/lib/unicode/scripts/constants.rb +3 -3
- data/lib/unicode/scripts.rb +4 -1
- data/spec/unicode_scripts_spec.rb +15 -2
- metadata +5 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b0b88898119662f0432faae60c47e9271c09cbf0b0be6a4eef47d5b7c4d92fff
|
|
4
|
+
data.tar.gz: 46d74594eed212777caffe3fa29bdaaf1f04ddfb5eaaf6f18e6b761a794cb2d1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 777938842e782d0fe2d4ae853e2d8311c65d2bfd2ab62bfed02bc0d43921ad01f1dfe349c56d02e83e7c496bc71c8278c462d0474baf233bffa54ecbd99aedaa
|
|
7
|
+
data.tar.gz: 4da9b319921f9146dd33080642ca34099af995da26b08546de360ef213cd90f16a2e2d045269d0478c641bf5f87f1dd34c629b6fea283923caa93d60bf43d99b
|
data/.rake_tasks
ADDED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,24 +1,41 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
unicode-scripts (1.
|
|
4
|
+
unicode-scripts (1.13.0)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: https://rubygems.org/
|
|
8
8
|
specs:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
drb (2.2.3)
|
|
10
|
+
erb (6.0.7)
|
|
11
|
+
io-console (0.9.4)
|
|
12
|
+
irb (1.18.0)
|
|
13
|
+
pp (>= 0.6.0)
|
|
14
|
+
prism (>= 1.3.0)
|
|
15
|
+
rdoc (>= 4.0.0)
|
|
16
|
+
reline (>= 0.4.2)
|
|
17
|
+
logger (1.7.0)
|
|
18
|
+
minitest (6.0.6)
|
|
19
|
+
drb (~> 2.0)
|
|
20
|
+
prism (~> 1.5)
|
|
21
|
+
minitest-mock (5.27.0)
|
|
22
|
+
pp (0.6.4)
|
|
23
|
+
prettyprint
|
|
24
|
+
prettyprint (0.2.0)
|
|
25
|
+
prism (1.9.0)
|
|
26
|
+
rake (13.4.2)
|
|
27
|
+
rbs (4.2.0)
|
|
28
|
+
logger
|
|
29
|
+
prism (>= 1.6.0)
|
|
30
|
+
tsort
|
|
31
|
+
rdoc (8.0.0)
|
|
32
|
+
erb
|
|
33
|
+
prism (>= 1.6.0)
|
|
34
|
+
rbs (>= 4.0.0)
|
|
35
|
+
tsort
|
|
36
|
+
reline (0.7.0)
|
|
20
37
|
io-console (~> 0.5)
|
|
21
|
-
|
|
38
|
+
tsort (0.2.0)
|
|
22
39
|
|
|
23
40
|
PLATFORMS
|
|
24
41
|
ruby
|
|
@@ -26,6 +43,7 @@ PLATFORMS
|
|
|
26
43
|
DEPENDENCIES
|
|
27
44
|
irb
|
|
28
45
|
minitest
|
|
46
|
+
minitest-mock
|
|
29
47
|
rake
|
|
30
48
|
unicode-scripts!
|
|
31
49
|
|
data/MIT-LICENSE.txt
CHANGED
data/README.md
CHANGED
|
@@ -4,9 +4,7 @@ Retrieve all [Unicode script(s)](https://en.wikipedia.org/wiki/Script_%28Unicode
|
|
|
4
4
|
|
|
5
5
|
Based on the *Script_Extension*, this library can also return the [augmented script set](https://www.unicode.org/reports/tr39/#def-augmented-script-set) to figure out if a string is **mixed-script** or **single-script**. Mixed scripts can be an indicator of suspicious user inputs.
|
|
6
6
|
|
|
7
|
-
Unicode version: **
|
|
8
|
-
|
|
9
|
-
Supported Rubies: **3.x** (might work: **2.x**)
|
|
7
|
+
Unicode version: **18.0.0** (September 2026)
|
|
10
8
|
|
|
11
9
|
## Gemfile
|
|
12
10
|
|
|
@@ -128,5 +126,5 @@ See [Idiosyncratic Ruby: Proper Unicoding](https://idiosyncratic-ruby.com/41-pro
|
|
|
128
126
|
|
|
129
127
|
## MIT License
|
|
130
128
|
|
|
131
|
-
- Copyright (C) 2016-
|
|
129
|
+
- Copyright (C) 2016-2026 Jan Lelis <https://janlelis.com>. Released under the MIT license.
|
|
132
130
|
- Unicode data: https://www.unicode.org/copyright.html#Exhibit1
|
data/data/scripts.marshal.gz
CHANGED
|
Binary file
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
module Unicode
|
|
4
4
|
module Scripts
|
|
5
|
-
VERSION = "1.
|
|
6
|
-
UNICODE_VERSION = "
|
|
5
|
+
VERSION = "1.13.0"
|
|
6
|
+
UNICODE_VERSION = "18.0.0"
|
|
7
7
|
DATA_DIRECTORY = File.expand_path(File.dirname(__FILE__) + "/../../../data/").freeze
|
|
8
8
|
INDEX_FILENAME = (DATA_DIRECTORY + "/scripts.marshal.gz").freeze
|
|
9
9
|
|
|
10
|
-
AUGMENTED_SCRIPT_CODES = ["Hanb", "Jpan", "Kore"]
|
|
10
|
+
AUGMENTED_SCRIPT_CODES = ["Hanb", "Hntl", "Jpan", "Kore"].freeze
|
|
11
11
|
end
|
|
12
12
|
end
|
data/lib/unicode/scripts.rb
CHANGED
|
@@ -62,7 +62,7 @@ module Unicode
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
if augmented.include? "Hani"
|
|
65
|
-
augmented |=
|
|
65
|
+
augmented |= Unicode::Scripts::AUGMENTED_SCRIPT_CODES
|
|
66
66
|
end
|
|
67
67
|
if augmented.include?("Hira") || augmented.include?("Kana")
|
|
68
68
|
augmented |= ["Jpan"]
|
|
@@ -73,6 +73,9 @@ module Unicode
|
|
|
73
73
|
if augmented.include? "Bopo"
|
|
74
74
|
augmented |= ["Hanb"]
|
|
75
75
|
end
|
|
76
|
+
if augmented.include? "Latn"
|
|
77
|
+
augmented |= ["Hntl"]
|
|
78
|
+
end
|
|
76
79
|
if augmented.include?("Zyyy") || augmented.include?("Zinh")
|
|
77
80
|
augmented |= names(format: :short, augmented: :include )
|
|
78
81
|
end
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require_relative "../lib/unicode/scripts"
|
|
2
|
+
require "minitest/mock"
|
|
2
3
|
require "minitest/autorun"
|
|
3
4
|
|
|
4
5
|
describe Unicode::Scripts do
|
|
@@ -138,7 +139,15 @@ describe Unicode::Scripts do
|
|
|
138
139
|
it "will return all extended scripts that characters in the string belong to + augmented" do
|
|
139
140
|
assert_equal ["Hira", "Jpan", "Kana"], Unicode::Scripts.augmented_scripts("ねガ")
|
|
140
141
|
end
|
|
141
|
-
|
|
142
|
+
|
|
143
|
+
it "add all Unicode::Scripts::AUGMENTED_SCRIPT_CODES for Han characters" do
|
|
144
|
+
assert_equal ["Hanb", "Hani", "Hntl", "Jpan", "Kore"], Unicode::Scripts.augmented_scripts("⺀")
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
it "add Hntl for Latin characters" do
|
|
148
|
+
assert_equal ["Hntl", "Latn"], Unicode::Scripts.augmented_scripts("A")
|
|
149
|
+
end
|
|
150
|
+
|
|
142
151
|
it "will replace Common with all scripts" do
|
|
143
152
|
assert_equal \
|
|
144
153
|
Unicode::Scripts.names(format: :short, augmented: :include),
|
|
@@ -183,11 +192,15 @@ describe Unicode::Scripts do
|
|
|
183
192
|
end
|
|
184
193
|
|
|
185
194
|
it "will return a list of all augmented script codes" do
|
|
186
|
-
assert_equal Unicode::Scripts.names(format: :short, augmented: :only), ["Hanb", "Jpan", "Kore"]
|
|
195
|
+
assert_equal Unicode::Scripts.names(format: :short, augmented: :only), ["Hanb", "Hntl", "Jpan", "Kore"]
|
|
187
196
|
end
|
|
188
197
|
end
|
|
189
198
|
|
|
190
199
|
describe '[unicode versions]' do
|
|
200
|
+
it "works for scripts introduced in Unicode 18" do
|
|
201
|
+
assert_equal "Jurchen", Unicode::Scripts.script("\u{18E20}")
|
|
202
|
+
end
|
|
203
|
+
|
|
191
204
|
it "works for scripts introduced in Unicode 17" do
|
|
192
205
|
assert_equal "Tai_Yo", Unicode::Scripts.script("")
|
|
193
206
|
end
|
metadata
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: unicode-scripts
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.13.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jan Lelis
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies: []
|
|
13
|
-
description: "[Unicode
|
|
12
|
+
description: "[Unicode 18.0.0] Retrieve the Unicode script(s) a string belongs to.
|
|
14
13
|
Can also return the Script_Extension property which is defined as characters which
|
|
15
14
|
are 'commonly used with more than one script, but with a limited number of scripts'. "
|
|
16
15
|
email:
|
|
@@ -20,6 +19,7 @@ extensions: []
|
|
|
20
19
|
extra_rdoc_files: []
|
|
21
20
|
files:
|
|
22
21
|
- ".gitignore"
|
|
22
|
+
- ".rake_tasks"
|
|
23
23
|
- CHANGELOG.md
|
|
24
24
|
- CODE_OF_CONDUCT.md
|
|
25
25
|
- Gemfile
|
|
@@ -39,7 +39,6 @@ licenses:
|
|
|
39
39
|
- MIT
|
|
40
40
|
metadata:
|
|
41
41
|
rubygems_mfa_required: 'true'
|
|
42
|
-
post_install_message:
|
|
43
42
|
rdoc_options: []
|
|
44
43
|
require_paths:
|
|
45
44
|
- lib
|
|
@@ -54,8 +53,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
54
53
|
- !ruby/object:Gem::Version
|
|
55
54
|
version: '0'
|
|
56
55
|
requirements: []
|
|
57
|
-
rubygems_version:
|
|
58
|
-
signing_key:
|
|
56
|
+
rubygems_version: 4.0.20
|
|
59
57
|
specification_version: 4
|
|
60
58
|
summary: Which script(s) does a Unicode string belong to?
|
|
61
59
|
test_files:
|