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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: '09dd3604fde1d681ba8ba3bdb5e04e4fd1b5b9c5'
4
- data.tar.gz: 328c4825cb65b85e186b864808da5f69271e8b2a
3
+ metadata.gz: 11b7e9c4b3d5a72e31eb03fc87a44649331fe7ff
4
+ data.tar.gz: 17ff36b31ddd1ae5d8126316ffb5961e0cbe9bb2
5
5
  SHA512:
6
- metadata.gz: 6015fe2ebcc4c195fc2c98f9ba594c70d913aef8b90924ccadf8f352a6098738ae96495674dd37a586cdd5a0b5b2ebbaf81f1b27d69bc17ace4ba5959026c8ef
7
- data.tar.gz: 456299e5e0ecf1f43cdc77c755c8ec22cf74c3432ce81407707af92b195a4f9547452df526a4abb5071999283a81f96153fe31afbb4e9d975d4c64809c63ed14
6
+ metadata.gz: 29d701b7bea82a3b7218ce189dd41024981270d34f67e465522e998be264a2fc51848a0067509a6f5ee23b91e0da7c07af795e11111fa1812fc4277221da5e22
7
+ data.tar.gz: e53033c8e0e27f1a0ec9d277214b43a1db5312e126ed9d7bd1dd52bc919683ef1db7c9e158f1e294b99d1c06237a8ff9f869f776908415575a8916e992906b4d
@@ -1,5 +1,11 @@
1
1
  ## CHANGELOG
2
2
 
3
+ ### 2.0.0.pre
4
+
5
+ #### Breaking Change
6
+
7
+ Strings which contain unassigned codepoints (general category of **Cn**), will raise a `Unicode::Age::UnknownAge` exception.
8
+
3
9
  ### 1.1.0
4
10
 
5
11
  * Detect Unicode 9.0 (Ruby 2.4)
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 return `nil`.
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
 
@@ -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
- return nil if string =~ /\A\p{Unassigned}*\z/
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
  }
@@ -1,6 +1,6 @@
1
1
  module Unicode
2
2
  module Age
3
- VERSION = "1.1.0".freeze
3
+ VERSION = "2.0.0.pre".freeze
4
4
  UNICODE_VERSION = "9.0.0".freeze
5
5
  end
6
6
  end
@@ -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 "returns nil for unassigned codepoints" do
17
- assert_equal nil, Unicode::Age.of("\u{10FFFF}")
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: 1.1.0
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: '0'
51
+ version: 1.3.1
53
52
  requirements: []
54
53
  rubyforge_project:
55
54
  rubygems_version: 2.6.8
Binary file