iri 0.8.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.0pdd.yml +22 -4
- data/.github/workflows/actionlint.yml +43 -0
- data/.github/workflows/codecov.yml +31 -7
- data/.github/workflows/copyrights.yml +32 -0
- data/.github/workflows/markdown-lint.yml +40 -0
- data/.github/workflows/pdd.yml +36 -0
- data/.github/workflows/rake.yml +28 -5
- data/.github/workflows/xcop.yml +32 -0
- data/.github/workflows/yamllint.yml +36 -0
- data/.gitignore +0 -1
- data/.rubocop.yml +27 -0
- data/.rultor.yml +23 -1
- data/Gemfile +8 -6
- data/Gemfile.lock +79 -0
- data/LICENSE.txt +1 -1
- data/README.md +17 -11
- data/Rakefile +1 -1
- data/iri.gemspec +2 -2
- data/lib/iri.rb +64 -5
- data/logo.svg +1 -1
- data/test/test__helper.rb +1 -1
- data/test/test_iri.rb +24 -2
- metadata +12 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9981ebf1f6a24c408671ca60df156211a1866a23c0ba2a5e8a7424dfb8461b4
|
4
|
+
data.tar.gz: f0bcbb8b78b70e14b1e6b42c7b141174aca57d00d0b1e33e101061bb10f12ee0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5cbeb1064fabf1906d158a48219f418a11ac0d11ed40b436988006710002c8b0ce3cb66381905e23e28c4b4479ebc4a03b324f7a3a4dc7692b5b11bee4d44361
|
7
|
+
data.tar.gz: fa47c762b50c2046f0d7b3beb3dce405362cd2079d04d554f764b88b985421510242a7fe281093eb7927b01a6c92d15cd41d6cccdad0be60d1f4513669876bf0
|
data/.0pdd.yml
CHANGED
@@ -1,9 +1,27 @@
|
|
1
|
+
# (The MIT License)
|
2
|
+
#
|
3
|
+
# Copyright (c) 2019-2025 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
---
|
1
23
|
errors:
|
2
24
|
- yegor256@gmail.com
|
3
|
-
# alerts:
|
4
|
-
# github:
|
5
|
-
# - yegor256
|
6
|
-
|
7
25
|
tags:
|
8
26
|
- pdd
|
9
27
|
- bug
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# (The MIT License)
|
2
|
+
#
|
3
|
+
# Copyright (c) 2019-2025 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
---
|
23
|
+
name: actionlint
|
24
|
+
'on':
|
25
|
+
push:
|
26
|
+
branches:
|
27
|
+
- master
|
28
|
+
pull_request:
|
29
|
+
branches:
|
30
|
+
- master
|
31
|
+
jobs:
|
32
|
+
actionlint:
|
33
|
+
runs-on: ubuntu-24.04
|
34
|
+
steps:
|
35
|
+
- uses: actions/checkout@v4
|
36
|
+
- name: Download actionlint
|
37
|
+
id: get_actionlint
|
38
|
+
# yamllint disable-line rule:line-length
|
39
|
+
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
|
40
|
+
shell: bash
|
41
|
+
- name: Check workflow files
|
42
|
+
run: ${{ steps.get_actionlint.outputs.executable }} -color
|
43
|
+
shell: bash
|
@@ -1,20 +1,44 @@
|
|
1
|
+
# (The MIT License)
|
2
|
+
#
|
3
|
+
# Copyright (c) 2019-2025 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
1
22
|
---
|
2
23
|
name: codecov
|
3
|
-
on:
|
24
|
+
'on':
|
4
25
|
push:
|
5
26
|
branches:
|
6
27
|
- master
|
7
28
|
jobs:
|
8
29
|
codecov:
|
9
|
-
runs-on: ubuntu-
|
30
|
+
runs-on: ubuntu-24.04
|
10
31
|
steps:
|
11
|
-
- uses: actions/checkout@
|
32
|
+
- uses: actions/checkout@v4
|
12
33
|
- uses: ruby/setup-ruby@v1
|
13
34
|
with:
|
14
|
-
ruby-version:
|
15
|
-
|
35
|
+
ruby-version: 3.3
|
36
|
+
bundler-cache: true
|
37
|
+
- run: bundle config set --global path "$(pwd)/vendor/bundle"
|
38
|
+
- run: bundle install
|
16
39
|
- run: bundle exec rake
|
17
|
-
- uses: codecov/codecov-action@
|
40
|
+
- uses: codecov/codecov-action@v5
|
18
41
|
with:
|
19
|
-
|
42
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
43
|
+
files: coverage/.resultset.json
|
20
44
|
fail_ci_if_error: true
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# (The MIT License)
|
2
|
+
#
|
3
|
+
# Copyright (c) 2019-2025 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
---
|
23
|
+
name: copyrights
|
24
|
+
'on':
|
25
|
+
push:
|
26
|
+
pull_request:
|
27
|
+
jobs:
|
28
|
+
copyrights:
|
29
|
+
runs-on: ubuntu-24.04
|
30
|
+
steps:
|
31
|
+
- uses: actions/checkout@v4
|
32
|
+
- uses: yegor256/copyrights-action@0.0.8
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# (The MIT License)
|
2
|
+
#
|
3
|
+
# Copyright (c) 2019-2025 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
---
|
23
|
+
name: markdown-lint
|
24
|
+
'on':
|
25
|
+
push:
|
26
|
+
branches:
|
27
|
+
- master
|
28
|
+
pull_request:
|
29
|
+
branches:
|
30
|
+
- master
|
31
|
+
paths-ignore: ['paper/**', 'sandbox/**']
|
32
|
+
concurrency:
|
33
|
+
group: markdown-lint-${{ github.ref }}
|
34
|
+
cancel-in-progress: true
|
35
|
+
jobs:
|
36
|
+
markdown-lint:
|
37
|
+
runs-on: ubuntu-24.04
|
38
|
+
steps:
|
39
|
+
- uses: actions/checkout@v4
|
40
|
+
- uses: articulate/actions-markdownlint@v1
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# (The MIT License)
|
2
|
+
#
|
3
|
+
# Copyright (c) 2019-2025 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
---
|
23
|
+
name: pdd
|
24
|
+
'on':
|
25
|
+
push:
|
26
|
+
branches:
|
27
|
+
- master
|
28
|
+
pull_request:
|
29
|
+
branches:
|
30
|
+
- master
|
31
|
+
jobs:
|
32
|
+
pdd:
|
33
|
+
runs-on: ubuntu-24.04
|
34
|
+
steps:
|
35
|
+
- uses: actions/checkout@v4
|
36
|
+
- uses: volodya-lombrozo/pdd-action@master
|
data/.github/workflows/rake.yml
CHANGED
@@ -1,6 +1,27 @@
|
|
1
|
+
# (The MIT License)
|
2
|
+
#
|
3
|
+
# Copyright (c) 2019-2025 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
1
22
|
---
|
2
23
|
name: rake
|
3
|
-
on:
|
24
|
+
'on':
|
4
25
|
push:
|
5
26
|
branches:
|
6
27
|
- master
|
@@ -12,13 +33,15 @@ jobs:
|
|
12
33
|
name: test
|
13
34
|
strategy:
|
14
35
|
matrix:
|
15
|
-
os: [ubuntu-
|
16
|
-
ruby: [
|
36
|
+
os: [ubuntu-24.04, macos-15, windows-2022]
|
37
|
+
ruby: [3.3]
|
17
38
|
runs-on: ${{ matrix.os }}
|
18
39
|
steps:
|
19
|
-
- uses: actions/checkout@
|
40
|
+
- uses: actions/checkout@v4
|
20
41
|
- uses: ruby/setup-ruby@v1
|
21
42
|
with:
|
22
43
|
ruby-version: ${{ matrix.ruby }}
|
23
|
-
|
44
|
+
bundler-cache: true
|
45
|
+
- run: bundle config set --global path "$(pwd)/vendor/bundle"
|
46
|
+
- run: bundle install
|
24
47
|
- run: bundle exec rake
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# (The MIT License)
|
2
|
+
#
|
3
|
+
# Copyright (c) 2019-2025 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
---
|
23
|
+
name: xcop
|
24
|
+
'on':
|
25
|
+
push:
|
26
|
+
pull_request:
|
27
|
+
jobs:
|
28
|
+
xcop:
|
29
|
+
runs-on: ubuntu-24.04
|
30
|
+
steps:
|
31
|
+
- uses: actions/checkout@v4
|
32
|
+
- uses: g4s8/xcop-action@master
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# (The MIT License)
|
2
|
+
#
|
3
|
+
# Copyright (c) 2019-2025 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
---
|
23
|
+
name: yamllint
|
24
|
+
'on':
|
25
|
+
push:
|
26
|
+
branches:
|
27
|
+
- master
|
28
|
+
pull_request:
|
29
|
+
branches:
|
30
|
+
- master
|
31
|
+
jobs:
|
32
|
+
yamllint:
|
33
|
+
runs-on: ubuntu-24.04
|
34
|
+
steps:
|
35
|
+
- uses: actions/checkout@v4
|
36
|
+
- uses: ibiqlik/action-yamllint@v3
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,9 +1,36 @@
|
|
1
|
+
# (The MIT License)
|
2
|
+
#
|
3
|
+
# Copyright (c) 2019-2025 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
---
|
1
23
|
AllCops:
|
2
24
|
DisplayCopNames: true
|
3
25
|
TargetRubyVersion: 2.2
|
4
26
|
SuggestExtensions: false
|
5
27
|
NewCops: enable
|
28
|
+
require:
|
29
|
+
- rubocop-minitest
|
30
|
+
- rubocop-performance
|
6
31
|
|
32
|
+
Minitest/EmptyLineBeforeAssertionMethods:
|
33
|
+
Enabled: false
|
7
34
|
Metrics/ClassLength:
|
8
35
|
Max: 200
|
9
36
|
Layout/EmptyLineAfterGuardClause:
|
data/.rultor.yml
CHANGED
@@ -1,5 +1,27 @@
|
|
1
|
+
# (The MIT License)
|
2
|
+
#
|
3
|
+
# Copyright (c) 2019-2025 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
---
|
1
23
|
docker:
|
2
|
-
image: yegor256/rultor-
|
24
|
+
image: yegor256/rultor-ruby
|
3
25
|
assets:
|
4
26
|
rubygems.yml: yegor256/home#assets/rubygems.yml
|
5
27
|
install: |-
|
data/Gemfile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2019-
|
3
|
+
# Copyright (c) 2019-2025 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
|
@@ -23,9 +23,11 @@
|
|
23
23
|
source 'https://rubygems.org'
|
24
24
|
gemspec
|
25
25
|
|
26
|
-
gem 'minitest', '5.
|
27
|
-
gem 'rake', '13.1
|
28
|
-
gem 'rdoc', '6.
|
29
|
-
gem 'rubocop', '1.
|
30
|
-
gem 'rubocop-
|
26
|
+
gem 'minitest', '5.25.4', require: false
|
27
|
+
gem 'rake', '13.2.1', require: false
|
28
|
+
gem 'rdoc', '6.11.0', require: false
|
29
|
+
gem 'rubocop', '1.71.0', require: false
|
30
|
+
gem 'rubocop-minitest', '0.36.0', require: false
|
31
|
+
gem 'rubocop-performance', '1.23.1', require: false
|
32
|
+
gem 'rubocop-rspec', '3.4.0', require: false
|
31
33
|
gem 'simplecov', '0.22.0', require: false
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
iri (0.0.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
ast (2.4.2)
|
10
|
+
date (3.4.1)
|
11
|
+
docile (1.4.1)
|
12
|
+
json (2.9.1)
|
13
|
+
language_server-protocol (3.17.0.4)
|
14
|
+
minitest (5.25.4)
|
15
|
+
parallel (1.26.3)
|
16
|
+
parser (3.3.7.0)
|
17
|
+
ast (~> 2.4.1)
|
18
|
+
racc
|
19
|
+
psych (5.2.3)
|
20
|
+
date
|
21
|
+
stringio
|
22
|
+
racc (1.8.1)
|
23
|
+
rainbow (3.1.1)
|
24
|
+
rake (13.2.1)
|
25
|
+
rdoc (6.11.0)
|
26
|
+
psych (>= 4.0.0)
|
27
|
+
regexp_parser (2.10.0)
|
28
|
+
rubocop (1.71.0)
|
29
|
+
json (~> 2.3)
|
30
|
+
language_server-protocol (>= 3.17.0)
|
31
|
+
parallel (~> 1.10)
|
32
|
+
parser (>= 3.3.0.2)
|
33
|
+
rainbow (>= 2.2.2, < 4.0)
|
34
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
35
|
+
rubocop-ast (>= 1.36.2, < 2.0)
|
36
|
+
ruby-progressbar (~> 1.7)
|
37
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
38
|
+
rubocop-ast (1.38.0)
|
39
|
+
parser (>= 3.3.1.0)
|
40
|
+
rubocop-minitest (0.36.0)
|
41
|
+
rubocop (>= 1.61, < 2.0)
|
42
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
43
|
+
rubocop-performance (1.23.1)
|
44
|
+
rubocop (>= 1.48.1, < 2.0)
|
45
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
46
|
+
rubocop-rspec (3.4.0)
|
47
|
+
rubocop (~> 1.61)
|
48
|
+
ruby-progressbar (1.13.0)
|
49
|
+
simplecov (0.22.0)
|
50
|
+
docile (~> 1.1)
|
51
|
+
simplecov-html (~> 0.11)
|
52
|
+
simplecov_json_formatter (~> 0.1)
|
53
|
+
simplecov-html (0.13.1)
|
54
|
+
simplecov_json_formatter (0.1.4)
|
55
|
+
stringio (3.1.2)
|
56
|
+
unicode-display_width (3.1.4)
|
57
|
+
unicode-emoji (~> 4.0, >= 4.0.4)
|
58
|
+
unicode-emoji (4.0.4)
|
59
|
+
|
60
|
+
PLATFORMS
|
61
|
+
arm64-darwin-22
|
62
|
+
arm64-darwin-23
|
63
|
+
arm64-darwin-24
|
64
|
+
x64-mingw-ucrt
|
65
|
+
x86_64-linux
|
66
|
+
|
67
|
+
DEPENDENCIES
|
68
|
+
iri!
|
69
|
+
minitest (= 5.25.4)
|
70
|
+
rake (= 13.2.1)
|
71
|
+
rdoc (= 6.11.0)
|
72
|
+
rubocop (= 1.71.0)
|
73
|
+
rubocop-minitest (= 0.36.0)
|
74
|
+
rubocop-performance (= 1.23.1)
|
75
|
+
rubocop-rspec (= 3.4.0)
|
76
|
+
simplecov (= 0.22.0)
|
77
|
+
|
78
|
+
BUNDLED WITH
|
79
|
+
2.5.16
|
data/LICENSE.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2019-
|
3
|
+
Copyright (c) 2019-2025 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
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
# Immutable URI Builder for Ruby
|
2
2
|
|
3
3
|
[![EO principles respected here](https://www.elegantobjects.org/badge.svg)](https://www.elegantobjects.org)
|
4
4
|
[![DevOps By Rultor.com](http://www.rultor.com/b/yegor256/iri)](http://www.rultor.com/p/yegor256/iri)
|
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
The class [`Iri`](https://www.rubydoc.info/github/yegor256/iri/master/Iri)
|
16
16
|
helps you build a URI and then modify its
|
17
|
-
parts via a simple [fluent interface]
|
17
|
+
parts via a simple [fluent interface]:
|
18
18
|
|
19
19
|
```ruby
|
20
20
|
require 'iri'
|
@@ -34,17 +34,18 @@ url = Iri.new('http://google.com/')
|
|
34
34
|
.to_s # convert it to a string
|
35
35
|
```
|
36
36
|
|
37
|
-
The full list of methods is
|
37
|
+
The full list of methods is
|
38
|
+
[here](https://www.rubydoc.info/github/yegor256/iri/master/Iri).
|
38
39
|
|
39
40
|
Install it:
|
40
41
|
|
41
42
|
```bash
|
42
|
-
|
43
|
+
gem install iri
|
43
44
|
```
|
44
45
|
|
45
46
|
Or add this to your `Gemfile`:
|
46
47
|
|
47
|
-
```
|
48
|
+
```ruby
|
48
49
|
gem 'iri'
|
49
50
|
```
|
50
51
|
|
@@ -64,18 +65,23 @@ Of course, it's better to create the `iri` object only once per request
|
|
64
65
|
and re-use it where you need. It's _immutable_, so you won't have any
|
65
66
|
side-effects.
|
66
67
|
|
67
|
-
PS. See how I use it in this Sinatra web app:
|
68
|
+
PS. See how I use it in this Sinatra web app:
|
69
|
+
[yegor256/0rsk](https://github.com/yegor256/0rsk).
|
68
70
|
|
69
71
|
## How to contribute
|
70
72
|
|
71
|
-
Read
|
73
|
+
Read
|
74
|
+
[these guidelines](https://www.yegor256.com/2014/04/15/github-guidelines.html).
|
72
75
|
Make sure you build is green before you contribute
|
73
|
-
your pull request. You will need to have
|
76
|
+
your pull request. You will need to have
|
77
|
+
[Ruby](https://www.ruby-lang.org/en/) 2.3+ and
|
74
78
|
[Bundler](https://bundler.io/) installed. Then:
|
75
79
|
|
76
|
-
```
|
77
|
-
|
78
|
-
|
80
|
+
```bash
|
81
|
+
bundle update
|
82
|
+
bundle exec rake
|
79
83
|
```
|
80
84
|
|
81
85
|
If it's clean and you don't see any error messages, submit your pull request.
|
86
|
+
|
87
|
+
[fluent interface]: https://en.wikipedia.org/wiki/Fluent_interface
|
data/Rakefile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2019-
|
3
|
+
# Copyright (c) 2019-2025 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/iri.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# (The MIT License)
|
4
4
|
#
|
5
|
-
# Copyright (c) 2019-
|
5
|
+
# Copyright (c) 2019-2025 Yegor Bugayenko
|
6
6
|
#
|
7
7
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
8
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
|
|
27
27
|
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
|
28
28
|
s.required_ruby_version = '>=2.2'
|
29
29
|
s.name = 'iri'
|
30
|
-
s.version = '0.
|
30
|
+
s.version = '0.10.0'
|
31
31
|
s.license = 'MIT'
|
32
32
|
s.summary = 'Simple Immutable Ruby URI Builder'
|
33
33
|
s.description = "Class Iri helps you build a URI and then modify its \
|
data/lib/iri.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# (The MIT License)
|
4
4
|
#
|
5
|
-
# Copyright (c) 2019-
|
5
|
+
# Copyright (c) 2019-2025 Yegor Bugayenko
|
6
6
|
#
|
7
7
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
8
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -42,7 +42,7 @@ require 'cgi'
|
|
42
42
|
# {README}[https://github.com/yegor256/iri/blob/master/README.md] file.
|
43
43
|
#
|
44
44
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
45
|
-
# Copyright:: Copyright (c) 2019-
|
45
|
+
# Copyright:: Copyright (c) 2019-2025 Yegor Bugayenko
|
46
46
|
# License:: MIT
|
47
47
|
class Iri
|
48
48
|
# When URI is not valid.
|
@@ -58,26 +58,55 @@ class Iri
|
|
58
58
|
# By default, this class will never throw any exceptions, even if your URI
|
59
59
|
# is not valid. It will just assume that the URI is"/". However,
|
60
60
|
# you can turn this mode off, by specifying safe as FALSE.
|
61
|
-
|
61
|
+
#
|
62
|
+
# @param [String] uri URI
|
63
|
+
# @param [Boolean] local Is it local (no host, port, and scheme)?
|
64
|
+
# @param [Boolean] safe Should it safe?
|
65
|
+
def initialize(uri = '', local: false, safe: true)
|
62
66
|
@uri = uri
|
67
|
+
@local = local
|
63
68
|
@safe = safe
|
64
69
|
end
|
65
70
|
|
66
71
|
# Convert it to a string.
|
72
|
+
#
|
73
|
+
# @return [String] New URI
|
67
74
|
def to_s
|
68
|
-
|
75
|
+
u = the_uri
|
76
|
+
if @local
|
77
|
+
[
|
78
|
+
u.path,
|
79
|
+
u.query ? "?#{u.query}" : '',
|
80
|
+
u.fragment ? "##{u.fragment}" : ''
|
81
|
+
].join
|
82
|
+
else
|
83
|
+
u.to_s
|
84
|
+
end
|
69
85
|
end
|
70
86
|
|
71
87
|
# Inspect it, like a string can be inspected.
|
88
|
+
#
|
89
|
+
# @return [String] Details of it
|
72
90
|
def inspect
|
73
91
|
@uri.to_s.inspect
|
74
92
|
end
|
75
93
|
|
76
94
|
# Convert it to an object of class +URI+.
|
95
|
+
#
|
96
|
+
# @return [String] New URI
|
77
97
|
def to_uri
|
78
98
|
the_uri.clone
|
79
99
|
end
|
80
100
|
|
101
|
+
# Removes the host, the port, and the scheme and returns
|
102
|
+
# only the local address, for example, converting "https://google.com/foo"
|
103
|
+
# into "/foo".
|
104
|
+
#
|
105
|
+
# @return [Iri] Iri with no host/port/scheme
|
106
|
+
def to_local
|
107
|
+
Iri.new(@uri, local: true, safe: @safe)
|
108
|
+
end
|
109
|
+
|
81
110
|
# Add a few query arguments.
|
82
111
|
#
|
83
112
|
# For example:
|
@@ -90,6 +119,8 @@ class Iri
|
|
90
119
|
#
|
91
120
|
# Iri.new('https://google.com').del(:q).add(q: 'test')
|
92
121
|
#
|
122
|
+
# @param [Hash] hash Hash of names/values to set into the query part
|
123
|
+
# @return [Iri] A new iri
|
93
124
|
def add(hash)
|
94
125
|
raise InvalidArguments unless hash.is_a?(Hash)
|
95
126
|
modify_query do |params|
|
@@ -106,6 +137,8 @@ class Iri
|
|
106
137
|
#
|
107
138
|
# Iri.new('https://google.com?q=test').del(:q)
|
108
139
|
#
|
140
|
+
# @param [Array] keys List of keys to delete
|
141
|
+
# @return [Iri] A new iri
|
109
142
|
def del(*keys)
|
110
143
|
modify_query do |params|
|
111
144
|
keys.each do |k|
|
@@ -118,6 +151,8 @@ class Iri
|
|
118
151
|
#
|
119
152
|
# Iri.new('https://google.com?q=test').over(q: 'hey you!')
|
120
153
|
#
|
154
|
+
# @param [Hash] hash Hash of names/values to set into the query part
|
155
|
+
# @return [Iri] A new iri
|
121
156
|
def over(hash)
|
122
157
|
raise InvalidArguments unless hash.is_a?(Hash)
|
123
158
|
modify_query do |params|
|
@@ -129,6 +164,9 @@ class Iri
|
|
129
164
|
end
|
130
165
|
|
131
166
|
# Replace the scheme.
|
167
|
+
#
|
168
|
+
# @param [String] val New scheme to set, like "https" or "http"
|
169
|
+
# @return [Iri] A new iri
|
132
170
|
def scheme(val)
|
133
171
|
modify do |c|
|
134
172
|
c.scheme = val
|
@@ -136,6 +174,9 @@ class Iri
|
|
136
174
|
end
|
137
175
|
|
138
176
|
# Replace the host.
|
177
|
+
#
|
178
|
+
# @param [String] val New host to set, like "google.com" or "192.168.0.1"
|
179
|
+
# @return [Iri] A new iri
|
139
180
|
def host(val)
|
140
181
|
modify do |c|
|
141
182
|
c.host = val
|
@@ -143,6 +184,9 @@ class Iri
|
|
143
184
|
end
|
144
185
|
|
145
186
|
# Replace the port.
|
187
|
+
#
|
188
|
+
# @param [String] val New TCP port to set, like "8080" or "443"
|
189
|
+
# @return [Iri] A new iri
|
146
190
|
def port(val)
|
147
191
|
modify do |c|
|
148
192
|
c.port = val
|
@@ -150,6 +194,9 @@ class Iri
|
|
150
194
|
end
|
151
195
|
|
152
196
|
# Replace the path part of the URI.
|
197
|
+
#
|
198
|
+
# @param [String] val New path to set, like "/foo/bar"
|
199
|
+
# @return [Iri] A new iri
|
153
200
|
def path(val)
|
154
201
|
modify do |c|
|
155
202
|
c.path = val
|
@@ -157,6 +204,9 @@ class Iri
|
|
157
204
|
end
|
158
205
|
|
159
206
|
# Replace the fragment part of the URI.
|
207
|
+
#
|
208
|
+
# @param [String] val New fragment to set, like "hello"
|
209
|
+
# @return [Iri] A new iri
|
160
210
|
def fragment(val)
|
161
211
|
modify do |c|
|
162
212
|
c.fragment = val.to_s
|
@@ -164,6 +214,9 @@ class Iri
|
|
164
214
|
end
|
165
215
|
|
166
216
|
# Replace the query part of the URI.
|
217
|
+
#
|
218
|
+
# @param [String] val New query to set, like "a=1&b=2"
|
219
|
+
# @return [Iri] A new iri
|
167
220
|
def query(val)
|
168
221
|
modify do |c|
|
169
222
|
c.query = val
|
@@ -177,6 +230,9 @@ class Iri
|
|
177
230
|
# Iri.new('https://google.com/a/b?q=test').cut('/hello')
|
178
231
|
#
|
179
232
|
# The result will contain "https://google.com/hello".
|
233
|
+
#
|
234
|
+
# @param [String] path New path to set, like "/foo"
|
235
|
+
# @return [Iri] A new iri
|
180
236
|
def cut(path = '/')
|
181
237
|
modify do |c|
|
182
238
|
c.query = nil
|
@@ -192,6 +248,9 @@ class Iri
|
|
192
248
|
# Iri.new('https://google.com/a/b?q=test').append('/hello')
|
193
249
|
#
|
194
250
|
# The result will contain "https://google.com/a/b/hello?q=test".
|
251
|
+
#
|
252
|
+
# @param [String] part New segment to add to existing path
|
253
|
+
# @return [Iri] A new iri
|
195
254
|
def append(part)
|
196
255
|
modify do |c|
|
197
256
|
tail = (c.path.end_with?('/') ? '' : '/') + CGI.escape(part.to_s)
|
@@ -211,7 +270,7 @@ class Iri
|
|
211
270
|
def modify
|
212
271
|
c = the_uri.clone
|
213
272
|
yield c
|
214
|
-
Iri.new(c)
|
273
|
+
Iri.new(c, local: @local, safe: @safe)
|
215
274
|
end
|
216
275
|
|
217
276
|
def modify_query
|
data/logo.svg
CHANGED
data/test/test__helper.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2019-
|
3
|
+
# Copyright (c) 2019-2025 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/test/test_iri.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# (The MIT License)
|
4
4
|
#
|
5
|
-
# Copyright (c) 2019-
|
5
|
+
# Copyright (c) 2019-2025 Yegor Bugayenko
|
6
6
|
#
|
7
7
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
8
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -27,7 +27,7 @@ require_relative '../lib/iri'
|
|
27
27
|
|
28
28
|
# Iri test.
|
29
29
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
30
|
-
# Copyright:: Copyright (c) 2019-
|
30
|
+
# Copyright:: Copyright (c) 2019-2025 Yegor Bugayenko
|
31
31
|
# License:: MIT
|
32
32
|
class IriTest < Minitest::Test
|
33
33
|
def test_builds_uri
|
@@ -43,6 +43,28 @@ class IriTest < Minitest::Test
|
|
43
43
|
assert_equal('https://localhost:443/?q=books+about+tennis&limit=10', url)
|
44
44
|
end
|
45
45
|
|
46
|
+
def test_converts_to_uri
|
47
|
+
assert_equal(
|
48
|
+
'https://alpha.local?t=1',
|
49
|
+
Iri.new('https://alpha.local').over(t: 1).to_uri.to_s
|
50
|
+
)
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_converts_to_local
|
54
|
+
{
|
55
|
+
'http://localhost:9292/' => '/',
|
56
|
+
'https://google.com/' => '/',
|
57
|
+
'https://google.com/foo' => '/foo',
|
58
|
+
'https://google.com/bar?x=900' => '/bar?x=900',
|
59
|
+
'https://google.com/what#yes' => '/what#yes',
|
60
|
+
'https://google.com/what?a=8&b=9#yes' => '/what?a=8&b=9#yes'
|
61
|
+
}.each { |a, b| assert_equal(b, Iri.new(a).to_local.to_s) }
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_deals_with_local
|
65
|
+
assert_equal('/foo?x=1', Iri.new('https://google.com/foo').to_local.add(x: 1).to_s)
|
66
|
+
end
|
67
|
+
|
46
68
|
def test_broken_uri
|
47
69
|
assert_raises Iri::InvalidURI do
|
48
70
|
Iri.new('https://example.com/>', safe: false).add(a: 1)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iri
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yegor Bugayenko
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Class Iri helps you build a URI and then modify its parts via a simple
|
14
14
|
immutable fluent interface. It always returns a new object instead of changing the
|
@@ -21,13 +21,20 @@ extra_rdoc_files:
|
|
21
21
|
files:
|
22
22
|
- ".0pdd.yml"
|
23
23
|
- ".gitattributes"
|
24
|
+
- ".github/workflows/actionlint.yml"
|
24
25
|
- ".github/workflows/codecov.yml"
|
26
|
+
- ".github/workflows/copyrights.yml"
|
27
|
+
- ".github/workflows/markdown-lint.yml"
|
28
|
+
- ".github/workflows/pdd.yml"
|
25
29
|
- ".github/workflows/rake.yml"
|
30
|
+
- ".github/workflows/xcop.yml"
|
31
|
+
- ".github/workflows/yamllint.yml"
|
26
32
|
- ".gitignore"
|
27
33
|
- ".pdd"
|
28
34
|
- ".rubocop.yml"
|
29
35
|
- ".rultor.yml"
|
30
36
|
- Gemfile
|
37
|
+
- Gemfile.lock
|
31
38
|
- LICENSE.txt
|
32
39
|
- README.md
|
33
40
|
- Rakefile
|
@@ -42,7 +49,7 @@ licenses:
|
|
42
49
|
- MIT
|
43
50
|
metadata:
|
44
51
|
rubygems_mfa_required: 'true'
|
45
|
-
post_install_message:
|
52
|
+
post_install_message:
|
46
53
|
rdoc_options:
|
47
54
|
- "--charset=UTF-8"
|
48
55
|
require_paths:
|
@@ -59,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
59
66
|
version: '0'
|
60
67
|
requirements: []
|
61
68
|
rubygems_version: 3.4.10
|
62
|
-
signing_key:
|
69
|
+
signing_key:
|
63
70
|
specification_version: 4
|
64
71
|
summary: Simple Immutable Ruby URI Builder
|
65
72
|
test_files: []
|