iri 0.8.0 → 0.9.0
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/.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 +55 -2
- data/logo.svg +1 -1
- data/test/test__helper.rb +1 -1
- data/test/test_iri.rb +20 -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: 6b0ead5ff4a49ffdb3c0dda53b2cd03d92746aa4a3338c0320b539be271e3f6b
|
|
4
|
+
data.tar.gz: 5c1b3de33446ec5e6f88dd077511ec5bb210692d4891da434cdbc778dba0107a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9d303b3a342e9d3f2517ae478f29ccbbd5bf4359afa7ed7237dd3e9b7991f9c060a6cc262f3af086364129d3b6de55901f42e0e9a3c42023539c6111fd3213d7
|
|
7
|
+
data.tar.gz: 274c64e316691fd65e05b14cef70bf18929a37225e2511492988d501a4d68253727cda1788d4596b123c5520178af0a7915b2a7a2672aeba65eb071acc00fa75
|
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
|
[](https://www.elegantobjects.org)
|
|
4
4
|
[](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.9.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,49 @@ 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
|
+
#
|
|
62
|
+
# @param [String] uri URI
|
|
63
|
+
# @param [Boolean] safe SHould it safe?
|
|
61
64
|
def initialize(uri = '', safe: true)
|
|
62
65
|
@uri = uri
|
|
63
66
|
@safe = safe
|
|
64
67
|
end
|
|
65
68
|
|
|
66
69
|
# Convert it to a string.
|
|
70
|
+
#
|
|
71
|
+
# @return [String] New URI
|
|
67
72
|
def to_s
|
|
68
73
|
@uri.to_s
|
|
69
74
|
end
|
|
70
75
|
|
|
71
76
|
# Inspect it, like a string can be inspected.
|
|
77
|
+
#
|
|
78
|
+
# @return [String] Details of it
|
|
72
79
|
def inspect
|
|
73
80
|
@uri.to_s.inspect
|
|
74
81
|
end
|
|
75
82
|
|
|
76
83
|
# Convert it to an object of class +URI+.
|
|
84
|
+
#
|
|
85
|
+
# @return [String] New URI
|
|
77
86
|
def to_uri
|
|
78
87
|
the_uri.clone
|
|
79
88
|
end
|
|
80
89
|
|
|
90
|
+
# Removes the host, the port, and the scheme and returns
|
|
91
|
+
# only the local address, for example, converting "https://google.com/foo"
|
|
92
|
+
# into "/foo".
|
|
93
|
+
#
|
|
94
|
+
# @return [String] Local part of the URI
|
|
95
|
+
def to_local
|
|
96
|
+
u = the_uri
|
|
97
|
+
[
|
|
98
|
+
u.path,
|
|
99
|
+
u.query ? "?#{u.query}" : '',
|
|
100
|
+
u.fragment ? "##{u.fragment}" : ''
|
|
101
|
+
].join
|
|
102
|
+
end
|
|
103
|
+
|
|
81
104
|
# Add a few query arguments.
|
|
82
105
|
#
|
|
83
106
|
# For example:
|
|
@@ -90,6 +113,8 @@ class Iri
|
|
|
90
113
|
#
|
|
91
114
|
# Iri.new('https://google.com').del(:q).add(q: 'test')
|
|
92
115
|
#
|
|
116
|
+
# @param [Hash] hash Hash of names/values to set into the query part
|
|
117
|
+
# @return [Iri] A new iri
|
|
93
118
|
def add(hash)
|
|
94
119
|
raise InvalidArguments unless hash.is_a?(Hash)
|
|
95
120
|
modify_query do |params|
|
|
@@ -106,6 +131,8 @@ class Iri
|
|
|
106
131
|
#
|
|
107
132
|
# Iri.new('https://google.com?q=test').del(:q)
|
|
108
133
|
#
|
|
134
|
+
# @param [Array] keys List of keys to delete
|
|
135
|
+
# @return [Iri] A new iri
|
|
109
136
|
def del(*keys)
|
|
110
137
|
modify_query do |params|
|
|
111
138
|
keys.each do |k|
|
|
@@ -118,6 +145,8 @@ class Iri
|
|
|
118
145
|
#
|
|
119
146
|
# Iri.new('https://google.com?q=test').over(q: 'hey you!')
|
|
120
147
|
#
|
|
148
|
+
# @param [Hash] hash Hash of names/values to set into the query part
|
|
149
|
+
# @return [Iri] A new iri
|
|
121
150
|
def over(hash)
|
|
122
151
|
raise InvalidArguments unless hash.is_a?(Hash)
|
|
123
152
|
modify_query do |params|
|
|
@@ -129,6 +158,9 @@ class Iri
|
|
|
129
158
|
end
|
|
130
159
|
|
|
131
160
|
# Replace the scheme.
|
|
161
|
+
#
|
|
162
|
+
# @param [String] val New scheme to set, like "https" or "http"
|
|
163
|
+
# @return [Iri] A new iri
|
|
132
164
|
def scheme(val)
|
|
133
165
|
modify do |c|
|
|
134
166
|
c.scheme = val
|
|
@@ -136,6 +168,9 @@ class Iri
|
|
|
136
168
|
end
|
|
137
169
|
|
|
138
170
|
# Replace the host.
|
|
171
|
+
#
|
|
172
|
+
# @param [String] val New host to set, like "google.com" or "192.168.0.1"
|
|
173
|
+
# @return [Iri] A new iri
|
|
139
174
|
def host(val)
|
|
140
175
|
modify do |c|
|
|
141
176
|
c.host = val
|
|
@@ -143,6 +178,9 @@ class Iri
|
|
|
143
178
|
end
|
|
144
179
|
|
|
145
180
|
# Replace the port.
|
|
181
|
+
#
|
|
182
|
+
# @param [String] val New TCP port to set, like "8080" or "443"
|
|
183
|
+
# @return [Iri] A new iri
|
|
146
184
|
def port(val)
|
|
147
185
|
modify do |c|
|
|
148
186
|
c.port = val
|
|
@@ -150,6 +188,9 @@ class Iri
|
|
|
150
188
|
end
|
|
151
189
|
|
|
152
190
|
# Replace the path part of the URI.
|
|
191
|
+
#
|
|
192
|
+
# @param [String] val New path to set, like "/foo/bar"
|
|
193
|
+
# @return [Iri] A new iri
|
|
153
194
|
def path(val)
|
|
154
195
|
modify do |c|
|
|
155
196
|
c.path = val
|
|
@@ -157,6 +198,9 @@ class Iri
|
|
|
157
198
|
end
|
|
158
199
|
|
|
159
200
|
# Replace the fragment part of the URI.
|
|
201
|
+
#
|
|
202
|
+
# @param [String] val New fragment to set, like "hello"
|
|
203
|
+
# @return [Iri] A new iri
|
|
160
204
|
def fragment(val)
|
|
161
205
|
modify do |c|
|
|
162
206
|
c.fragment = val.to_s
|
|
@@ -164,6 +208,9 @@ class Iri
|
|
|
164
208
|
end
|
|
165
209
|
|
|
166
210
|
# Replace the query part of the URI.
|
|
211
|
+
#
|
|
212
|
+
# @param [String] val New query to set, like "a=1&b=2"
|
|
213
|
+
# @return [Iri] A new iri
|
|
167
214
|
def query(val)
|
|
168
215
|
modify do |c|
|
|
169
216
|
c.query = val
|
|
@@ -177,6 +224,9 @@ class Iri
|
|
|
177
224
|
# Iri.new('https://google.com/a/b?q=test').cut('/hello')
|
|
178
225
|
#
|
|
179
226
|
# The result will contain "https://google.com/hello".
|
|
227
|
+
#
|
|
228
|
+
# @param [String] path New path to set, like "/foo"
|
|
229
|
+
# @return [Iri] A new iri
|
|
180
230
|
def cut(path = '/')
|
|
181
231
|
modify do |c|
|
|
182
232
|
c.query = nil
|
|
@@ -192,6 +242,9 @@ class Iri
|
|
|
192
242
|
# Iri.new('https://google.com/a/b?q=test').append('/hello')
|
|
193
243
|
#
|
|
194
244
|
# The result will contain "https://google.com/a/b/hello?q=test".
|
|
245
|
+
#
|
|
246
|
+
# @param [String] part New segment to add to existing path
|
|
247
|
+
# @return [Iri] A new iri
|
|
195
248
|
def append(part)
|
|
196
249
|
modify do |c|
|
|
197
250
|
tail = (c.path.end_with?('/') ? '' : '/') + CGI.escape(part.to_s)
|
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,24 @@ 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) }
|
|
62
|
+
end
|
|
63
|
+
|
|
46
64
|
def test_broken_uri
|
|
47
65
|
assert_raises Iri::InvalidURI do
|
|
48
66
|
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.9.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: []
|