unicode-age 1.1.0 → 2.0.0.pre
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 +6 -0
- data/README.md +3 -1
- data/lib/unicode/age.rb +3 -1
- data/lib/unicode/age/version.rb +1 -1
- data/spec/unicode_age_spec.rb +4 -2
- metadata +3 -4
- data/.README.md.swp +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11b7e9c4b3d5a72e31eb03fc87a44649331fe7ff
|
4
|
+
data.tar.gz: 17ff36b31ddd1ae5d8126316ffb5961e0cbe9bb2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29d701b7bea82a3b7218ce189dd41024981270d34f67e465522e998be264a2fc51848a0067509a6f5ee23b91e0da7c07af795e11111fa1812fc4277221da5e22
|
7
|
+
data.tar.gz: e53033c8e0e27f1a0ec9d277214b43a1db5312e126ed9d7bd1dd52bc919683ef1db7c9e158f1e294b99d1c06237a8ff9f869f776908415575a8916e992906b4d
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -14,7 +14,9 @@ Unicode::Age.of "\u{10FFFF}" # => nil
|
|
14
14
|
Unicode::Age.of "\u{10FFFD}" # => 2.0
|
15
15
|
```
|
16
16
|
|
17
|
-
Characters of status "Unassigned" (Unicode General Category of **Cn**) will
|
17
|
+
Characters of status "Unassigned" (Unicode General Category of **Cn**) will raise a `Unicode::Age::UnknownAge` exception.
|
18
|
+
|
19
|
+
**This is a breaking change:** In the current non-*pre* version of the gem on rubygems.org, unassigned characters will just return `nil`
|
18
20
|
|
19
21
|
## Supported Ruby/Unicode versions
|
20
22
|
|
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,
|
@@ -31,7 +33,7 @@ module Unicode
|
|
31
33
|
}.compact.freeze
|
32
34
|
|
33
35
|
def self.of(string)
|
34
|
-
|
36
|
+
raise(UnknownAge, "The string containts unassigned codepoints, so the Unicode version required cannot be determined. Your Ruby version supports Unicode #{UNICODE_VERSION}.") if string =~ /\A\p{Unassigned}*\z/
|
35
37
|
KNOWN_UNICODE_VERSIONS.find.with_index{ |uv, index|
|
36
38
|
string =~ KNOWN_UNICODE_REGEXES[index]
|
37
39
|
}
|
data/lib/unicode/age/version.rb
CHANGED
data/spec/unicode_age_spec.rb
CHANGED
@@ -13,8 +13,10 @@ describe Unicode::Age do
|
|
13
13
|
assert_equal 9.0, Unicode::Age.of("🛒 ") if RUBY_VERSION >= "2.4.0"
|
14
14
|
end
|
15
15
|
|
16
|
-
it "
|
17
|
-
|
16
|
+
it "will raise Unicode::Age::UnknownAge exception for unassigned characters" do
|
17
|
+
assert_raises Unicode::Age::UnknownAge do
|
18
|
+
assert_equal nil, Unicode::Age.of("\u{10FFFF}")
|
19
|
+
end
|
18
20
|
end
|
19
21
|
end
|
20
22
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unicode-age
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Lelis
|
@@ -18,7 +18,6 @@ executables: []
|
|
18
18
|
extensions: []
|
19
19
|
extra_rdoc_files: []
|
20
20
|
files:
|
21
|
-
- ".README.md.swp"
|
22
21
|
- ".gitignore"
|
23
22
|
- ".travis.yml"
|
24
23
|
- CHANGELOG.md
|
@@ -47,9 +46,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
47
46
|
version: '2.0'
|
48
47
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
48
|
requirements:
|
50
|
-
- - "
|
49
|
+
- - ">"
|
51
50
|
- !ruby/object:Gem::Version
|
52
|
-
version:
|
51
|
+
version: 1.3.1
|
53
52
|
requirements: []
|
54
53
|
rubyforge_project:
|
55
54
|
rubygems_version: 2.6.8
|
data/.README.md.swp
DELETED
Binary file
|