iri 0.11.3 → 0.11.5
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/Gemfile +3 -3
- data/Gemfile.lock +17 -16
- data/LICENSE.txt +1 -1
- data/LICENSES/MIT.txt +1 -1
- data/README.md +0 -1
- data/Rakefile +1 -1
- data/iri.gemspec +3 -3
- data/lib/iri.rb +11 -12
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 32dd06d46f3e63261c7e24410e56038974ace83eecbd04623b981ac75b066bc6
|
|
4
|
+
data.tar.gz: 0ea7d9af045ff9cf0a6bc43ed9dc6b263a79ec641ada6f5d22e43d22dd1ea562
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ac08d8d5ca552f3ac93328ef478edb3ddc83719daf06ebb9afbbe72500a02994fe9602a0d5999c661abb294a35a6d08f3982a14f2fc98a444235af4b629c20a2
|
|
7
|
+
data.tar.gz: cf21ed44b8cdbdec9a0888d9938080a0ab53f9315558ae20f09e0403613030800bbdff8aef65359c3fc1916c0928c2596d48a19f284cdd1dc6b63cbdad3e695a
|
data/Gemfile
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# SPDX-FileCopyrightText: Copyright (c) 2019-
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2019-2026 Yegor Bugayenko
|
|
4
4
|
# SPDX-License-Identifier: MIT
|
|
5
5
|
|
|
6
6
|
source 'https://rubygems.org'
|
|
7
7
|
gemspec
|
|
8
8
|
|
|
9
|
-
gem 'minitest', '~>
|
|
9
|
+
gem 'minitest', '~>6.0', require: false
|
|
10
10
|
gem 'minitest-reporters', '~>1.7', require: false
|
|
11
11
|
gem 'rake', '~>13.2', require: false
|
|
12
|
-
gem 'rdoc', '
|
|
12
|
+
gem 'rdoc', '7.0.3', require: false # GPL
|
|
13
13
|
gem 'rubocop', '~>1.74', require: false
|
|
14
14
|
gem 'rubocop-minitest', '~>0.38', require: false
|
|
15
15
|
gem 'rubocop-performance', '~>1.25', require: false
|
data/Gemfile.lock
CHANGED
|
@@ -9,13 +9,14 @@ GEM
|
|
|
9
9
|
ansi (1.5.0)
|
|
10
10
|
ast (2.4.3)
|
|
11
11
|
builder (3.3.0)
|
|
12
|
-
date (3.5.
|
|
12
|
+
date (3.5.1)
|
|
13
13
|
docile (1.4.1)
|
|
14
|
-
erb (6.0.
|
|
15
|
-
json (2.
|
|
14
|
+
erb (6.0.1)
|
|
15
|
+
json (2.18.0)
|
|
16
16
|
language_server-protocol (3.17.0.5)
|
|
17
17
|
lint_roller (1.1.0)
|
|
18
|
-
minitest (
|
|
18
|
+
minitest (6.0.1)
|
|
19
|
+
prism (~> 1.5)
|
|
19
20
|
minitest-reporters (1.7.1)
|
|
20
21
|
ansi
|
|
21
22
|
builder
|
|
@@ -25,20 +26,20 @@ GEM
|
|
|
25
26
|
parser (3.3.10.0)
|
|
26
27
|
ast (~> 2.4.1)
|
|
27
28
|
racc
|
|
28
|
-
prism (1.
|
|
29
|
-
psych (5.
|
|
29
|
+
prism (1.7.0)
|
|
30
|
+
psych (5.3.1)
|
|
30
31
|
date
|
|
31
32
|
stringio
|
|
32
33
|
racc (1.8.1)
|
|
33
34
|
rainbow (3.1.1)
|
|
34
35
|
rake (13.3.1)
|
|
35
|
-
rdoc (
|
|
36
|
+
rdoc (7.0.3)
|
|
36
37
|
erb
|
|
37
38
|
psych (>= 4.0.0)
|
|
38
39
|
tsort
|
|
39
40
|
regexp_parser (2.11.3)
|
|
40
41
|
rexml (3.4.4)
|
|
41
|
-
rubocop (1.
|
|
42
|
+
rubocop (1.82.1)
|
|
42
43
|
json (~> 2.3)
|
|
43
44
|
language_server-protocol (~> 3.17.0.2)
|
|
44
45
|
lint_roller (~> 1.1.0)
|
|
@@ -46,12 +47,12 @@ GEM
|
|
|
46
47
|
parser (>= 3.3.0.2)
|
|
47
48
|
rainbow (>= 2.2.2, < 4.0)
|
|
48
49
|
regexp_parser (>= 2.9.3, < 3.0)
|
|
49
|
-
rubocop-ast (>= 1.
|
|
50
|
+
rubocop-ast (>= 1.48.0, < 2.0)
|
|
50
51
|
ruby-progressbar (~> 1.7)
|
|
51
52
|
unicode-display_width (>= 2.4.0, < 4.0)
|
|
52
|
-
rubocop-ast (1.
|
|
53
|
+
rubocop-ast (1.49.0)
|
|
53
54
|
parser (>= 3.3.7.2)
|
|
54
|
-
prism (~> 1.
|
|
55
|
+
prism (~> 1.7)
|
|
55
56
|
rubocop-minitest (0.38.2)
|
|
56
57
|
lint_roller (~> 1.1)
|
|
57
58
|
rubocop (>= 1.75.0, < 2.0)
|
|
@@ -73,12 +74,12 @@ GEM
|
|
|
73
74
|
simplecov (~> 0.19)
|
|
74
75
|
simplecov-html (0.13.2)
|
|
75
76
|
simplecov_json_formatter (0.1.4)
|
|
76
|
-
stringio (3.
|
|
77
|
+
stringio (3.2.0)
|
|
77
78
|
tsort (0.2.0)
|
|
78
79
|
unicode-display_width (3.2.0)
|
|
79
80
|
unicode-emoji (~> 4.1)
|
|
80
|
-
unicode-emoji (4.
|
|
81
|
-
yard (0.9.
|
|
81
|
+
unicode-emoji (4.2.0)
|
|
82
|
+
yard (0.9.38)
|
|
82
83
|
|
|
83
84
|
PLATFORMS
|
|
84
85
|
arm64-darwin-23
|
|
@@ -88,10 +89,10 @@ PLATFORMS
|
|
|
88
89
|
|
|
89
90
|
DEPENDENCIES
|
|
90
91
|
iri!
|
|
91
|
-
minitest (~>
|
|
92
|
+
minitest (~> 6.0)
|
|
92
93
|
minitest-reporters (~> 1.7)
|
|
93
94
|
rake (~> 13.2)
|
|
94
|
-
rdoc (=
|
|
95
|
+
rdoc (= 7.0.3)
|
|
95
96
|
rubocop (~> 1.74)
|
|
96
97
|
rubocop-minitest (~> 0.38)
|
|
97
98
|
rubocop-performance (~> 1.25)
|
data/LICENSE.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2019-
|
|
3
|
+
Copyright (c) 2019-2026 Yegor Bugayenko
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/LICENSES/MIT.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2019-
|
|
3
|
+
Copyright (c) 2019-2026 Yegor Bugayenko
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
[](https://github.com/yegor256/iri/actions/workflows/rake.yml)
|
|
8
8
|
[](https://badge.fury.io/rb/iri)
|
|
9
|
-
[](https://codeclimate.com/github/yegor256/iri/maintainability)
|
|
10
9
|
[](https://rubydoc.info/github/yegor256/iri/master/frames)
|
|
11
10
|
[](https://github.com/yegor256/iri/blob/master/LICENSE.txt)
|
|
12
11
|
[](https://codecov.io/github/yegor256/iri?branch=master)
|
data/Rakefile
CHANGED
data/iri.gemspec
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# SPDX-FileCopyrightText: Copyright (c) 2019-
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2019-2026 Yegor Bugayenko
|
|
4
4
|
# SPDX-License-Identifier: MIT
|
|
5
5
|
|
|
6
6
|
require 'English'
|
|
@@ -9,14 +9,14 @@ Gem::Specification.new do |s|
|
|
|
9
9
|
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
|
|
10
10
|
s.required_ruby_version = '>=2.2'
|
|
11
11
|
s.name = 'iri'
|
|
12
|
-
s.version = '0.11.
|
|
12
|
+
s.version = '0.11.5'
|
|
13
13
|
s.license = 'MIT'
|
|
14
14
|
s.summary = 'Simple Immutable Ruby URI Builder'
|
|
15
15
|
s.description =
|
|
16
16
|
'Class Iri helps you build a URI and then modify its ' \
|
|
17
17
|
'parts via a simple immutable fluent interface. It always returns a new ' \
|
|
18
18
|
'object instead of changing the existing one. This makes the object ' \
|
|
19
|
-
'safer and much easier
|
|
19
|
+
'safer and much easier to reuse.'
|
|
20
20
|
s.authors = ['Yegor Bugayenko']
|
|
21
21
|
s.email = 'yegor256@gmail.com'
|
|
22
22
|
s.homepage = 'https://github.com/yegor256/iri'
|
data/lib/iri.rb
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# SPDX-FileCopyrightText: Copyright (c) 2019-
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2019-2026 Yegor Bugayenko
|
|
4
4
|
# SPDX-License-Identifier: MIT
|
|
5
5
|
|
|
6
6
|
require 'uri'
|
|
7
|
-
require 'cgi'
|
|
8
7
|
|
|
9
8
|
# Iri is a simple, immutable URI builder with a fluent interface.
|
|
10
9
|
#
|
|
@@ -35,7 +34,7 @@ require 'cgi'
|
|
|
35
34
|
# {README}[https://github.com/yegor256/iri/blob/master/README.md] file.
|
|
36
35
|
#
|
|
37
36
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
38
|
-
# Copyright:: Copyright (c) 2019-
|
|
37
|
+
# Copyright:: Copyright (c) 2019-2026 Yegor Bugayenko
|
|
39
38
|
# License:: MIT
|
|
40
39
|
class Iri
|
|
41
40
|
# Exception raised when a URI is not valid and safe mode is disabled.
|
|
@@ -220,7 +219,7 @@ class Iri
|
|
|
220
219
|
raise ArgumentError, "The scheme can't be nil" if val.nil?
|
|
221
220
|
val = val.to_s
|
|
222
221
|
raise ArgumentError, "The scheme can't be empty" if val.empty?
|
|
223
|
-
modify do |c|
|
|
222
|
+
modify(local: false) do |c|
|
|
224
223
|
c.scheme = val
|
|
225
224
|
end
|
|
226
225
|
end
|
|
@@ -239,7 +238,7 @@ class Iri
|
|
|
239
238
|
raise ArgumentError, "The host can't be nil" if val.nil?
|
|
240
239
|
val = val.to_s
|
|
241
240
|
raise ArgumentError, "The host can't be empty" if val.empty?
|
|
242
|
-
modify do |c|
|
|
241
|
+
modify(local: false) do |c|
|
|
243
242
|
c.host = val
|
|
244
243
|
end
|
|
245
244
|
end
|
|
@@ -260,7 +259,7 @@ class Iri
|
|
|
260
259
|
raise ArgumentError, "The port can'be negative" if val.negative?
|
|
261
260
|
raise ArgumentError, "The port can'be zero" if val.zero?
|
|
262
261
|
raise ArgumentError, "The port can'be larger than 65536" if val > 65_536
|
|
263
|
-
modify do |c|
|
|
262
|
+
modify(local: false) do |c|
|
|
264
263
|
c.port = val
|
|
265
264
|
end
|
|
266
265
|
end
|
|
@@ -378,7 +377,7 @@ class Iri
|
|
|
378
377
|
part = part.to_s
|
|
379
378
|
raise ArgumentError, "The part can't be empty" if part.empty?
|
|
380
379
|
modify do |c|
|
|
381
|
-
tail = (c.path.end_with?('/') ? '' : '/') +
|
|
380
|
+
tail = (c.path.end_with?('/') ? '' : '/') + URI.encode_www_form_component(part.to_s)
|
|
382
381
|
c.path = c.path + tail
|
|
383
382
|
end
|
|
384
383
|
end
|
|
@@ -407,10 +406,10 @@ class Iri
|
|
|
407
406
|
#
|
|
408
407
|
# @yield [URI] The cloned URI object for modification
|
|
409
408
|
# @return [Iri] A new Iri instance with the modified URI
|
|
410
|
-
def modify
|
|
409
|
+
def modify(local: @local, safe: @safe)
|
|
411
410
|
c = the_uri.clone
|
|
412
411
|
yield c
|
|
413
|
-
Iri.new(c, local:
|
|
412
|
+
Iri.new(c, local: local, safe: safe)
|
|
414
413
|
end
|
|
415
414
|
|
|
416
415
|
# Creates a new Iri object after modifying the query parameters.
|
|
@@ -423,9 +422,9 @@ class Iri
|
|
|
423
422
|
# @return [Iri] A new Iri instance with the modified query string
|
|
424
423
|
def modify_query
|
|
425
424
|
modify do |c|
|
|
426
|
-
params =
|
|
427
|
-
[
|
|
428
|
-
end
|
|
425
|
+
params = URI.decode_www_form(the_uri.query || '').each_with_object({}) do |(k, v), h|
|
|
426
|
+
(h[k] ||= []) << v
|
|
427
|
+
end
|
|
429
428
|
yield(params)
|
|
430
429
|
c.query = URI.encode_www_form(params)
|
|
431
430
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: iri
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.11.
|
|
4
|
+
version: 0.11.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yegor Bugayenko
|
|
@@ -11,7 +11,7 @@ date: 1980-01-02 00:00:00.000000000 Z
|
|
|
11
11
|
dependencies: []
|
|
12
12
|
description: Class Iri helps you build a URI and then modify its parts via a simple
|
|
13
13
|
immutable fluent interface. It always returns a new object instead of changing the
|
|
14
|
-
existing one. This makes the object safer and much easier
|
|
14
|
+
existing one. This makes the object safer and much easier to reuse.
|
|
15
15
|
email: yegor256@gmail.com
|
|
16
16
|
executables: []
|
|
17
17
|
extensions: []
|