iri 0.5.0 → 0.5.1
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 +1 -1
- data/LICENSE.txt +1 -1
- data/README.md +2 -0
- data/Rakefile +1 -1
- data/iri.gemspec +6 -6
- data/lib/iri.rb +14 -6
- data/test/test__helper.rb +1 -1
- data/test/test_iri.rb +9 -2
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db8863ed27f231ba61cdff169239ea612436272a7150f036c9796fc2d90c0834
|
4
|
+
data.tar.gz: e67d192cf430e94f64c3aab87f4f064b6c4915e28c8c6d2dba82afda8aeaaeba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9be16a1579273c5796c63a121eb39d03061bfaae5e1fad217c76fe13699cb46f64d0c59c568227a6853cccec41f45b880a4c2ecc3f2e957516c38d5b6f05215
|
7
|
+
data.tar.gz: 1330a503f87585553fb4e507d7c81f3f0ef8c02583838b136110dfcc243cfa5da14a9b91bd8360a6e0df43f4bd719fdb63b4c1804a49cd5dcc798db161e7a813
|
data/Gemfile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2019 Yegor Bugayenko
|
3
|
+
# Copyright (c) 2019-2021 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/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -29,6 +29,8 @@ url = Iri.new('http://google.com/')
|
|
29
29
|
.scheme('https') # replace 'http' with 'https'
|
30
30
|
.host('localhost') # replace the host name
|
31
31
|
.port('443') # replace the port
|
32
|
+
.fragment('page-4') # replaces the fragment part of the URI, after the '#'
|
33
|
+
.query('a=1&b=2') # replaces the entire query part of the URI
|
32
34
|
.path('/new/path') # replace the path of the URI, leaving the query untouched
|
33
35
|
.cut('/q') # replace everything after the host and port
|
34
36
|
.to_s # convert it to a string
|
data/Rakefile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2019 Yegor Bugayenko
|
3
|
+
# Copyright (c) 2019-2021 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 Yegor Bugayenko
|
5
|
+
# Copyright (c) 2019-2021 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
|
@@ -31,22 +31,22 @@ Gem::Specification.new do |s|
|
|
31
31
|
s.rubygems_version = '2.5'
|
32
32
|
s.required_ruby_version = '>=2.2'
|
33
33
|
s.name = 'iri'
|
34
|
-
s.version = '0.5.
|
34
|
+
s.version = '0.5.1'
|
35
35
|
s.license = 'MIT'
|
36
36
|
s.summary = 'Simple Immutable Ruby URI Builder'
|
37
37
|
s.description = 'Class Iri helps you build a URI and then modify its \
|
38
38
|
parts via a simple fluent interface.'
|
39
39
|
s.authors = ['Yegor Bugayenko']
|
40
40
|
s.email = 'yegor256@gmail.com'
|
41
|
-
s.homepage = '
|
41
|
+
s.homepage = 'https://github.com/yegor256/iri'
|
42
42
|
s.files = `git ls-files`.split($RS)
|
43
43
|
s.test_files = s.files.grep(%r{^(test)/})
|
44
44
|
s.rdoc_options = ['--charset=UTF-8']
|
45
45
|
s.extra_rdoc_files = ['README.md']
|
46
|
-
s.add_development_dependency 'codecov', '0.
|
46
|
+
s.add_development_dependency 'codecov', '0.2.11'
|
47
47
|
s.add_development_dependency 'minitest', '5.11.3'
|
48
|
-
s.add_development_dependency 'rake', '12.3.
|
49
|
-
s.add_development_dependency 'rdoc', '
|
48
|
+
s.add_development_dependency 'rake', '12.3.3'
|
49
|
+
s.add_development_dependency 'rdoc', '6.3.1'
|
50
50
|
s.add_development_dependency 'rubocop', '0.62.0'
|
51
51
|
s.add_development_dependency 'rubocop-rspec', '1.31.0'
|
52
52
|
end
|
data/lib/iri.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# (The MIT License)
|
4
4
|
#
|
5
|
-
# Copyright (c) 2019 Yegor Bugayenko
|
5
|
+
# Copyright (c) 2019-2021 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 Yegor Bugayenko
|
45
|
+
# Copyright:: Copyright (c) 2019-2021 Yegor Bugayenko
|
46
46
|
# License:: MIT
|
47
47
|
class Iri
|
48
48
|
# When URI is not valid.
|
@@ -70,7 +70,9 @@ class Iri
|
|
70
70
|
the_uri.clone
|
71
71
|
end
|
72
72
|
|
73
|
-
# Add a few query arguments.
|
73
|
+
# Add a few query arguments.
|
74
|
+
#
|
75
|
+
# For example:
|
74
76
|
#
|
75
77
|
# Iri.new('https://google.com').add(q: 'test', limit: 10)
|
76
78
|
#
|
@@ -89,7 +91,9 @@ class Iri
|
|
89
91
|
end
|
90
92
|
end
|
91
93
|
|
92
|
-
# Delete a few query arguments.
|
94
|
+
# Delete a few query arguments.
|
95
|
+
#
|
96
|
+
# For example:
|
93
97
|
#
|
94
98
|
# Iri.new('https://google.com?q=test').del(:q)
|
95
99
|
#
|
@@ -156,7 +160,9 @@ class Iri
|
|
156
160
|
end
|
157
161
|
end
|
158
162
|
|
159
|
-
# Remove the entire path+query+fragment part.
|
163
|
+
# Remove the entire path+query+fragment part.
|
164
|
+
#
|
165
|
+
# For example:
|
160
166
|
#
|
161
167
|
# Iri.new('https://google.com/a/b?q=test').cut('/hello')
|
162
168
|
#
|
@@ -169,7 +175,9 @@ class Iri
|
|
169
175
|
end
|
170
176
|
end
|
171
177
|
|
172
|
-
# Append something new to the path
|
178
|
+
# Append something new to the path.
|
179
|
+
#
|
180
|
+
# For example:
|
173
181
|
#
|
174
182
|
# Iri.new('https://google.com/a/b?q=test').append('/hello')
|
175
183
|
#
|
data/test/test__helper.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2019 Yegor Bugayenko
|
3
|
+
# Copyright (c) 2019-2021 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 Yegor Bugayenko
|
5
|
+
# Copyright (c) 2019-2021 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 Yegor Bugayenko
|
30
|
+
# Copyright:: Copyright (c) 2019-2021 Yegor Bugayenko
|
31
31
|
# License:: MIT
|
32
32
|
class IriTest < Minitest::Test
|
33
33
|
def test_builds_uri
|
@@ -138,6 +138,13 @@ class IriTest < Minitest::Test
|
|
138
138
|
)
|
139
139
|
end
|
140
140
|
|
141
|
+
def test_appends_to_empty_ending
|
142
|
+
assert_equal(
|
143
|
+
'http://google.com/hello',
|
144
|
+
Iri.new('http://google.com/').append('hello').to_s
|
145
|
+
)
|
146
|
+
end
|
147
|
+
|
141
148
|
def test_appends_empty_path
|
142
149
|
assert_equal(
|
143
150
|
'http://google.com/hello/',
|
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.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yegor Bugayenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: codecov
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.2.11
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.2.11
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: minitest
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,28 +44,28 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 12.3.
|
47
|
+
version: 12.3.3
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 12.3.
|
54
|
+
version: 12.3.3
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rdoc
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 6.3.1
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 6.3.1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rubocop
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -119,7 +119,7 @@ files:
|
|
119
119
|
- logo.svg
|
120
120
|
- test/test__helper.rb
|
121
121
|
- test/test_iri.rb
|
122
|
-
homepage:
|
122
|
+
homepage: https://github.com/yegor256/iri
|
123
123
|
licenses:
|
124
124
|
- MIT
|
125
125
|
metadata: {}
|
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
139
|
- !ruby/object:Gem::Version
|
140
140
|
version: '0'
|
141
141
|
requirements: []
|
142
|
-
rubygems_version: 3.
|
142
|
+
rubygems_version: 3.1.2
|
143
143
|
signing_key:
|
144
144
|
specification_version: 2
|
145
145
|
summary: Simple Immutable Ruby URI Builder
|