unicode-age 1.0.0 → 1.0.1
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/.travis.yml +5 -2
- data/CHANGELOG.md +4 -0
- data/README.md +7 -1
- data/lib/unicode/age.rb +9 -2
- data/lib/unicode/age/version.rb +1 -1
- data/spec/unicode_age_spec.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5c5cc3c3abd30c8572e612824fa4eb2bafca0f09
|
|
4
|
+
data.tar.gz: 381569a79f4b1d08f51e3bafd8ecc86de9a8e19d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 172016091f8f1df92d4fc3f076aafc6d1ed7448d121082e4aec2a0175ee16a45eeefed552b68160f833f638210d4b3c5e743ef47033bf05f2747257abc1e6728
|
|
7
|
+
data.tar.gz: 4db8b392cd5dce76d1453a38b05f8f3815c78bc9d7f8ce444654871776bdc320b9cf49b38370b9264264e44b58d6dd8abe61e8e7844bf26ed33618b9a80556ff
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -15,7 +15,13 @@ Unicode::Age.of "\u{10FFFD}" # => 2.0
|
|
|
15
15
|
|
|
16
16
|
Characters of status "Unassigned" (Unicode General Category of **Cn**) will return `nil`.
|
|
17
17
|
|
|
18
|
-
Unicode
|
|
18
|
+
## Supported Ruby/Unicode versions
|
|
19
|
+
|
|
20
|
+
Ruby version | Unicode version
|
|
21
|
+
-------------|----------------
|
|
22
|
+
**2.3** | **8.0.0**
|
|
23
|
+
**2.2** | **7.0.0**
|
|
24
|
+
**2.1** | **6.1.0**
|
|
19
25
|
|
|
20
26
|
## MIT License
|
|
21
27
|
|
data/lib/unicode/age.rb
CHANGED
|
@@ -22,10 +22,17 @@ module Unicode
|
|
|
22
22
|
8.0,
|
|
23
23
|
].freeze
|
|
24
24
|
|
|
25
|
+
KNOWN_UNICODE_REGEXES = KNOWN_UNICODE_VERSIONS.map{ |uv|
|
|
26
|
+
begin
|
|
27
|
+
/\A\p{age=#{"%.1f" % uv}}*\z/
|
|
28
|
+
rescue RegexpError
|
|
29
|
+
end
|
|
30
|
+
}.compact.freeze
|
|
31
|
+
|
|
25
32
|
def self.of(string)
|
|
26
33
|
return nil if string =~ /\A\p{Unassigned}*\z/
|
|
27
|
-
KNOWN_UNICODE_VERSIONS.find{ |uv|
|
|
28
|
-
string =~
|
|
34
|
+
KNOWN_UNICODE_VERSIONS.find.with_index{ |uv, index|
|
|
35
|
+
string =~ KNOWN_UNICODE_REGEXES[index]
|
|
29
36
|
}
|
|
30
37
|
end
|
|
31
38
|
end
|
data/lib/unicode/age/version.rb
CHANGED
data/spec/unicode_age_spec.rb
CHANGED
|
@@ -8,8 +8,8 @@ describe Unicode::Age do
|
|
|
8
8
|
assert_equal 3.0, Unicode::Age.of("ℜսᖯʏ")
|
|
9
9
|
assert_equal 3.1, Unicode::Age.of("ℜ𝘂ᖯʏ")
|
|
10
10
|
assert_equal 6.0, Unicode::Age.of("🚡")
|
|
11
|
-
assert_equal 7.0, Unicode::Age.of("🛲")
|
|
12
|
-
assert_equal 8.0, Unicode::Age.of("🌮 ")
|
|
11
|
+
assert_equal 7.0, Unicode::Age.of("🛲") if RUBY_VERSION >= "2.2.0"
|
|
12
|
+
assert_equal 8.0, Unicode::Age.of("🌮 ") if RUBY_VERSION >= "2.3.0"
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
it "returns nil for unassigned codepoints" do
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: unicode-age
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jan Lelis
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-
|
|
11
|
+
date: 2016-04-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: A micromodule to detect which Unicode version is required to display
|
|
14
14
|
a string.
|
|
@@ -51,7 +51,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
51
51
|
version: '0'
|
|
52
52
|
requirements: []
|
|
53
53
|
rubyforge_project:
|
|
54
|
-
rubygems_version: 2.
|
|
54
|
+
rubygems_version: 2.6.3
|
|
55
55
|
signing_key:
|
|
56
56
|
specification_version: 4
|
|
57
57
|
summary: Determine required Unicode version of a string.
|