unicode-age 1.1.0 → 2.2.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 +5 -5
- data/CHANGELOG.md +22 -0
- data/Gemfile +1 -0
- data/MIT-LICENSE.txt +1 -1
- data/README.md +5 -9
- data/Rakefile +14 -0
- data/lib/unicode/age.rb +7 -1
- data/lib/unicode/age/version.rb +4 -2
- data/spec/unicode_age_spec.rb +5 -2
- data/unicode-age.gemspec +2 -2
- metadata +10 -9
- data/.README.md.swp +0 -0
- data/.travis.yml +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz: '
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: '044887cc2a5f310d1c29a083a78e88e9c43ae818abe113a84b861edef7f8e36e'
|
4
|
+
data.tar.gz: f9d3cf944fa4ed27440371dce5094463b77303b0245989007a7b9eac8222e277
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da21861d6834b9fb68f4c399fe8a07c6b1101f88f1afd03713f3b92f34bea838e79f7888f464b3c43ba7dafd8a2c09bb4b9ee807ebb07a929f09e36b4d36bb88
|
7
|
+
data.tar.gz: 0a1bcae0b8c5fae2fda9622d07ac3edd865ed7170b0527a719fdf36aa243415422ae422a58c1c400b0b2ef3516e687570ba8a4c9b275b843fc597e9c4f99a0f3
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,27 @@
|
|
1
1
|
## CHANGELOG
|
2
2
|
|
3
|
+
### 2.2.0
|
4
|
+
|
5
|
+
* Support Ruby 3.0
|
6
|
+
|
7
|
+
### 2.1.0
|
8
|
+
|
9
|
+
* Support Unicode 12.0 (Ruby 2.6.2), Unicode 12.1 (Ruby 2.6.3)
|
10
|
+
|
11
|
+
### 2.0.1
|
12
|
+
|
13
|
+
* Support Unicode 11 (Ruby 2.6.1, 2.6.0)
|
14
|
+
|
15
|
+
### 2.0.0
|
16
|
+
|
17
|
+
#### Breaking change
|
18
|
+
|
19
|
+
Strings which contain unassigned codepoints (general category of **Cn**), will raise a `Unicode::Age::UnknownAge` exception.
|
20
|
+
|
21
|
+
#### Unicode update
|
22
|
+
|
23
|
+
Add Unicode 10 to list of known Unicode versions
|
24
|
+
|
3
25
|
### 1.1.0
|
4
26
|
|
5
27
|
* Detect Unicode 9.0 (Ruby 2.4)
|
data/Gemfile
CHANGED
data/MIT-LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Unicode::Age [![[version]](https://badge.fury.io/rb/unicode-age.svg)](
|
1
|
+
# Unicode::Age [![[version]](https://badge.fury.io/rb/unicode-age.svg)](https://badge.fury.io/rb/unicode-age) [![[ci]](https://github.com/janlelis/unicode-age/workflows/Test/badge.svg)](https://github.com/janlelis/unicode-age/actions?query=workflow%3ATest)
|
2
2
|
|
3
3
|
A micromodule to detect which Unicode version is required to display a string.
|
4
4
|
|
@@ -10,21 +10,17 @@ Unicode::Age.of "🚡" # => 6.0
|
|
10
10
|
Unicode::Age.of "🛲" # => 7.0
|
11
11
|
Unicode::Age.of "🌮 " # => 8.0
|
12
12
|
Unicode::Age.of "🛒" # => 9.0
|
13
|
+
Unicode::Age.of "🛷" # => 10.0
|
13
14
|
Unicode::Age.of "\u{10FFFF}" # => nil
|
14
15
|
Unicode::Age.of "\u{10FFFD}" # => 2.0
|
15
16
|
```
|
16
17
|
|
17
|
-
Characters of status "Unassigned" (Unicode General Category of **Cn**) will
|
18
|
+
Characters of status "Unassigned" (Unicode General Category of **Cn**) will raise a `Unicode::Age::UnknownAge` exception.
|
18
19
|
|
19
20
|
## Supported Ruby/Unicode versions
|
20
21
|
|
21
|
-
Ruby version
|
22
|
-
-------------|----------------
|
23
|
-
**2.4** | **9.0.0**
|
24
|
-
**2.3** | **8.0.0**
|
25
|
-
**2.2** | **7.0.0**
|
26
|
-
**2.1** | **6.1.0**
|
22
|
+
See the [Unicode — Ruby version table at Idiosyncratic Ruby](https://idiosyncratic-ruby.com/73-unicode-version-mapping.html)
|
27
23
|
|
28
24
|
## MIT License
|
29
25
|
|
30
|
-
Copyright (C) 2016-
|
26
|
+
Copyright (C) 2016-2020 Jan Lelis <https://janlelis.com>. Released under the MIT license.
|
data/Rakefile
CHANGED
@@ -28,3 +28,17 @@ desc "#{gemspec.name} | IRB"
|
|
28
28
|
task :irb do
|
29
29
|
sh "irb -I ./lib -r #{gemspec.name.gsub '-','/'}"
|
30
30
|
end
|
31
|
+
|
32
|
+
# # #
|
33
|
+
# Run Specs
|
34
|
+
|
35
|
+
desc "#{gemspec.name} | Spec"
|
36
|
+
task :spec do
|
37
|
+
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
|
38
|
+
sh "for %f in (spec/\*.rb) do ruby spec/%f"
|
39
|
+
else
|
40
|
+
sh "for file in spec/*.rb; do ruby $file; done"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
task default: :spec
|
44
|
+
|
data/lib/unicode/age.rb
CHANGED
@@ -2,6 +2,8 @@ require_relative "age/version"
|
|
2
2
|
|
3
3
|
module Unicode
|
4
4
|
module Age
|
5
|
+
class UnknownAge < StandardError; end
|
6
|
+
|
5
7
|
KNOWN_UNICODE_VERSIONS = [
|
6
8
|
1.1,
|
7
9
|
2.0,
|
@@ -21,6 +23,10 @@ module Unicode
|
|
21
23
|
7.0,
|
22
24
|
8.0,
|
23
25
|
9.0,
|
26
|
+
10.0,
|
27
|
+
11.0,
|
28
|
+
12.0,
|
29
|
+
12.1,
|
24
30
|
].freeze
|
25
31
|
|
26
32
|
KNOWN_UNICODE_REGEXES = KNOWN_UNICODE_VERSIONS.map{ |uv|
|
@@ -31,7 +37,7 @@ module Unicode
|
|
31
37
|
}.compact.freeze
|
32
38
|
|
33
39
|
def self.of(string)
|
34
|
-
|
40
|
+
raise(UnknownAge, "The string contains unassigned codepoints, so the Unicode version required cannot be determined. This gem version supports Unicode upto version #{UNICODE_VERSION}.") if string =~ /\A\p{Unassigned}*\z/
|
35
41
|
KNOWN_UNICODE_VERSIONS.find.with_index{ |uv, index|
|
36
42
|
string =~ KNOWN_UNICODE_REGEXES[index]
|
37
43
|
}
|
data/lib/unicode/age/version.rb
CHANGED
data/spec/unicode_age_spec.rb
CHANGED
@@ -11,10 +11,13 @@ describe Unicode::Age do
|
|
11
11
|
assert_equal 7.0, Unicode::Age.of("🛲 ") if RUBY_VERSION >= "2.2.0"
|
12
12
|
assert_equal 8.0, Unicode::Age.of("🌮 ") if RUBY_VERSION >= "2.3.0"
|
13
13
|
assert_equal 9.0, Unicode::Age.of("🛒 ") if RUBY_VERSION >= "2.4.0"
|
14
|
+
assert_equal 10.0, Unicode::Age.of("🛷 ") if RUBY_VERSION >= "2.5.0"
|
14
15
|
end
|
15
16
|
|
16
|
-
it "
|
17
|
-
|
17
|
+
it "will raise Unicode::Age::UnknownAge exception for unassigned characters" do
|
18
|
+
assert_raises Unicode::Age::UnknownAge do
|
19
|
+
assert_equal nil, Unicode::Age.of("\u{10FFFF}")
|
20
|
+
end
|
18
21
|
end
|
19
22
|
end
|
20
23
|
|
data/unicode-age.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.summary = "Determine required Unicode version of a string."
|
9
9
|
gem.description = "[Unicode #{Unicode::Age::UNICODE_VERSION}] A micromodule to detect which Unicode version is required to display a string."
|
10
10
|
gem.authors = ["Jan Lelis"]
|
11
|
-
gem.email = ["
|
11
|
+
gem.email = ["hi@ruby.consulting"]
|
12
12
|
gem.homepage = "https://github.com/janlelis/unicode-age"
|
13
13
|
gem.license = "MIT"
|
14
14
|
|
@@ -17,5 +17,5 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
18
|
gem.require_paths = ["lib"]
|
19
19
|
|
20
|
-
gem.required_ruby_version = "
|
20
|
+
gem.required_ruby_version = ">= 2.0", "< 4.0"
|
21
21
|
end
|
metadata
CHANGED
@@ -1,29 +1,28 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unicode-age
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Lelis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description: "[Unicode
|
13
|
+
description: "[Unicode 12.1.0] A micromodule to detect which Unicode version is required
|
14
14
|
to display a string."
|
15
15
|
email:
|
16
|
-
-
|
16
|
+
- hi@ruby.consulting
|
17
17
|
executables: []
|
18
18
|
extensions: []
|
19
19
|
extra_rdoc_files: []
|
20
20
|
files:
|
21
|
-
- ".README.md.swp"
|
22
21
|
- ".gitignore"
|
23
|
-
- ".travis.yml"
|
24
22
|
- CHANGELOG.md
|
25
23
|
- CODE_OF_CONDUCT.md
|
26
24
|
- Gemfile
|
25
|
+
- Gemfile.lock
|
27
26
|
- MIT-LICENSE.txt
|
28
27
|
- README.md
|
29
28
|
- Rakefile
|
@@ -42,17 +41,19 @@ require_paths:
|
|
42
41
|
- lib
|
43
42
|
required_ruby_version: !ruby/object:Gem::Requirement
|
44
43
|
requirements:
|
45
|
-
- - "
|
44
|
+
- - ">="
|
46
45
|
- !ruby/object:Gem::Version
|
47
46
|
version: '2.0'
|
47
|
+
- - "<"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '4.0'
|
48
50
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
51
|
requirements:
|
50
52
|
- - ">="
|
51
53
|
- !ruby/object:Gem::Version
|
52
54
|
version: '0'
|
53
55
|
requirements: []
|
54
|
-
|
55
|
-
rubygems_version: 2.6.8
|
56
|
+
rubygems_version: 3.2.3
|
56
57
|
signing_key:
|
57
58
|
specification_version: 4
|
58
59
|
summary: Determine required Unicode version of a string.
|
data/.README.md.swp
DELETED
Binary file
|
data/.travis.yml
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
sudo: false
|
2
|
-
language: ruby
|
3
|
-
|
4
|
-
script: bundle exec ruby spec/unicode_age_spec.rb
|
5
|
-
|
6
|
-
rvm:
|
7
|
-
- 2.4.0
|
8
|
-
- 2.3.3
|
9
|
-
- 2.2
|
10
|
-
- 2.1
|
11
|
-
- ruby-head
|
12
|
-
- jruby-head
|
13
|
-
- jruby-9.1.7.0
|
14
|
-
|
15
|
-
cache:
|
16
|
-
- bundler
|
17
|
-
|
18
|
-
matrix:
|
19
|
-
allow_failures:
|
20
|
-
- rvm: jruby-head
|
21
|
-
- rvm: jruby-9.1.7.0
|