unicode-numeric_value 1.10.0 → 1.12.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/CHANGELOG.md +9 -0
- data/Gemfile.lock +1 -1
- data/MIT-LICENSE.txt +1 -1
- data/README.md +3 -6
- data/data/numeric_value.marshal.gz +0 -0
- data/lib/unicode/numeric_value/constants.rb +2 -2
- data/lib/unicode/numeric_value.rb +2 -2
- data/spec/unicode_numeric_value_spec.rb +8 -0
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70d8508e52783a36a74ef9418d264befeb2433e446fdc929515a583138b83844
|
4
|
+
data.tar.gz: 5d2688d5bc25a7eb707c23c49ffd21ec02120e0040b27ee1cd3e3723539e8c99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d970d0db78bd27bec7490acb501c985e8a3ecac6ba841cf83a8556d3329d64a2260ffe94c0f9abd8a441ff74f7851f66ecac78e2d1f4a27a95c32b213ce6cbb
|
7
|
+
data.tar.gz: 4d6218e4c368529445836de8cbd12c671422b1ef5d4af994098ae6357a7d287257a1b856278c0254dee8c6e0e3852fbb9672f22549657a044bb7e3175b8c44eb
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/MIT-LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -2,11 +2,7 @@
|
|
2
2
|
|
3
3
|
Convert a Unicode character into its numeric value.
|
4
4
|
|
5
|
-
Unicode version: **
|
6
|
-
|
7
|
-
Supported Rubies: **3.2**, **3.1**, **3.0**
|
8
|
-
|
9
|
-
Old Rubies that might still work: **2.X**
|
5
|
+
Unicode version: **17.0.0** (September 2025)
|
10
6
|
|
11
7
|
## Gemfile
|
12
8
|
|
@@ -29,6 +25,7 @@ Unicode::NumericValue.of("༳") # => (-1/2)
|
|
29
25
|
Unicode::NumericValue.of("𑿀") # => (1/320)
|
30
26
|
Unicode::NumericValue.of("𖭡") # => 1000000000000
|
31
27
|
Unicode::NumericValue.of("五") # => 5
|
28
|
+
Unicode::NumericValue.of("") # => 7
|
32
29
|
Unicode::NumericValue.of("A") # => nil
|
33
30
|
```
|
34
31
|
|
@@ -61,5 +58,5 @@ puts "Codepoint | Character | Numeric Value | Name\n" \
|
|
61
58
|
|
62
59
|
## MIT License
|
63
60
|
|
64
|
-
- Copyright (C) 2016-
|
61
|
+
- Copyright (C) 2016-2025 Jan Lelis <https://janlelis.com>. Released under the MIT license.
|
65
62
|
- Unicode data: https://www.unicode.org/copyright.html#Exhibit1
|
Binary file
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
module Unicode
|
4
4
|
module NumericValue
|
5
|
-
VERSION = "1.
|
6
|
-
UNICODE_VERSION = "
|
5
|
+
VERSION = "1.12.0"
|
6
|
+
UNICODE_VERSION = "17.0.0"
|
7
7
|
DATA_DIRECTORY = File.expand_path(File.dirname(__FILE__) + "/../../../data/").freeze
|
8
8
|
INDEX_FILENAME = (DATA_DIRECTORY + "/numeric_value.marshal.gz").freeze
|
9
9
|
end
|
@@ -6,13 +6,13 @@ module Unicode
|
|
6
6
|
codepoint = char.unpack("U")[0] or
|
7
7
|
raise(ArgumentError, "Unicode::NumericValue.numeric_value must be given a valid char")
|
8
8
|
require_relative "numeric_value/index" unless defined? ::Unicode::NumericValue::INDEX
|
9
|
-
INDEX[codepoint]
|
9
|
+
INDEX[:NUMBERS][codepoint]
|
10
10
|
end
|
11
11
|
class << self; alias of numeric_value; end
|
12
12
|
|
13
13
|
def self.chars
|
14
14
|
require_relative "numeric_value/index" unless defined? ::Unicode::NumericValue::INDEX
|
15
|
-
INDEX.keys.sort.map{ |codepoint| [codepoint].pack("U") }
|
15
|
+
INDEX[:NUMBERS].keys.sort.map{ |codepoint| [codepoint].pack("U") }
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
@@ -10,6 +10,14 @@ describe Unicode::NumericValue do
|
|
10
10
|
assert_equal 1000000000000, Unicode::NumericValue.of("𖭡")
|
11
11
|
end
|
12
12
|
|
13
|
+
it "works with numbers from Unicode 17 (2025)" do
|
14
|
+
assert_equal 1, Unicode::NumericValue.of("")
|
15
|
+
end
|
16
|
+
|
17
|
+
it "works with numbers from Unicode 16 (2024)" do
|
18
|
+
assert_equal 7, Unicode::NumericValue.of("")
|
19
|
+
end
|
20
|
+
|
13
21
|
it "will return rational values" do
|
14
22
|
assert_equal 3/4r, Unicode::NumericValue.of("¾")
|
15
23
|
assert_equal -1/2r, Unicode::NumericValue.of("༳")
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unicode-numeric_value
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Lelis
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description: "[Unicode
|
13
|
+
description: "[Unicode 17.0.0] Returns the numeric value associated with a Unicode
|
14
14
|
character"
|
15
15
|
email:
|
16
16
|
- hi@ruby.consulting
|
@@ -39,7 +39,7 @@ licenses:
|
|
39
39
|
- MIT
|
40
40
|
metadata:
|
41
41
|
rubygems_mfa_required: 'true'
|
42
|
-
post_install_message:
|
42
|
+
post_install_message:
|
43
43
|
rdoc_options: []
|
44
44
|
require_paths:
|
45
45
|
- lib
|
@@ -54,8 +54,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '0'
|
56
56
|
requirements: []
|
57
|
-
rubygems_version: 3.
|
58
|
-
signing_key:
|
57
|
+
rubygems_version: 3.5.21
|
58
|
+
signing_key:
|
59
59
|
specification_version: 4
|
60
60
|
summary: Returns the numeric value associated with a Unicode character
|
61
61
|
test_files:
|