uri-idna 0.2.1 → 0.2.2

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
  SHA256:
3
- metadata.gz: 90b0f85ec0c8f446c31e27d21bbec12432dd8420dad9cc832b49db7841b524fe
4
- data.tar.gz: d82a9c301f37b391852206bc5fe82b01f2fc71750743a5e5309bdf9dd5b48f49
3
+ metadata.gz: a31f65444a2088912d65c6755cf7e1cb16ae1936c801245b29804f55414a6b67
4
+ data.tar.gz: 1538c13b89e089e53f7d249ac6b3ce628e163bbd65d30f36cddc2b97007382b3
5
5
  SHA512:
6
- metadata.gz: e6d00f5c92cc2413b6fc7c4d36e1ee94fd6ede4e4dba1e01d934313811ac5483226637d0c70d200a037448fc84b8445c6ecdd599000ff56647f7077c0cc0ab2e
7
- data.tar.gz: 7281c010c9134b72d4f6d63014143dce1f8864ff3beb1fa53ab6e2103acc44a46ca4ba5677679435a16b18b680ccdbf9a4fe1bb06f313f12bcfcc677dbfbaec0
6
+ metadata.gz: d26a6d183474bc619cf282d712874c06a91a522207c539ee9a1c67bf51474b3084e67dea2a1f2315b1852204eeea5b3df67bc20412a26d5bd18561dc3899833e
7
+ data.tar.gz: 3b2d6a1ed2a1e79e55e9569959a5fcc86203e22696c03bbce33b788681385072026c4dcab2888346249856ffd0ea9a66a13071caa5309ba8c8cb7040af9a7d2e
data/CHANGELOG.md CHANGED
@@ -5,7 +5,11 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog],
6
6
  and this project adheres to [Semantic Versioning].
7
7
 
8
- ## [Unreleased]
8
+ ## [0.2.2] - 2023-11-25
9
+
10
+ ### Changed
11
+
12
+ - Internal implementation moved to regex-based algorithm to improve performance. ([@skryukov])
9
13
 
10
14
  ## [0.2.1] - 2023-11-15
11
15
 
@@ -37,7 +41,9 @@ and this project adheres to [Semantic Versioning].
37
41
 
38
42
  [@skryukov]: https://github.com/skryukov
39
43
 
40
- [Unreleased]: https://github.com/skryukov/uri-idna/compare/v0.2.0...HEAD
44
+ [Unreleased]: https://github.com/skryukov/uri-idna/compare/v0.2.2...HEAD
45
+ [0.2.2]: https://github.com/skryukov/uri-idna/compare/v0.2.1...v0.2.2
46
+ [0.2.1]: https://github.com/skryukov/uri-idna/compare/v0.2.0...v0.2.1
41
47
  [0.2.0]: https://github.com/skryukov/uri-idna/compare/v0.1.0...v0.2.0
42
48
  [0.1.0]: https://github.com/skryukov/uri-idna/commits/v0.1.0
43
49
 
@@ -1,27 +1,33 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "validation/label"
4
- require_relative "validation/codepoint"
5
4
  require_relative "validation/bidi"
6
5
 
7
6
  module URI
8
7
  module IDNA
9
8
  class BaseProcessing
9
+ class << self
10
+ def default_options
11
+ @default_options ||= options_class.new
12
+ end
13
+
14
+ def options_class
15
+ raise NotImplementedError, "Implement #options_class method"
16
+ end
17
+ end
18
+
10
19
  def initialize(domain_name, **options)
11
20
  @domain_name = domain_name
12
- @options = options_class.new(**options)
21
+ @options = options.any? ? self.class.options_class.new(**options) : self.class.default_options
13
22
  end
14
23
 
15
24
  private
16
25
 
17
26
  attr_reader :domain_name, :options
18
27
 
19
- def options_class
20
- raise NotImplementedError, "Implement #options_class method"
21
- end
22
-
23
28
  def punycode_decode(label)
24
29
  raise Error, "Label contains non-ASCII code point" unless label.ascii_only?
30
+ raise Error, "A-label must not end with a hyphen" if label[-1] == "-"
25
31
 
26
32
  code = label[ACE_PREFIX.length..]
27
33
  raise Error, "Malformed A-label, no Punycode eligible content found" if code.empty?