iri 0.4.0 → 0.4.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/README.md +2 -0
- data/iri.gemspec +1 -1
- data/lib/iri.rb +2 -2
- data/test/test_iri.rb +9 -5
- 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: 8fa11fe8dcd6a808c1fb1f138058146eabde5bcc6df1f3c3e8e9a49a27553c8c
|
4
|
+
data.tar.gz: 13716fbf20a9ef77d9e8113e0fe6705041873d47eb4b4ffe27cbfa9a5cbeddb4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4de74dac632a463bf0001fd3d32bfb00b4c06beb1587e28dc6ff574a1415c6458b83d97c8ce185312fd6e8fa8a6d53e43b6c7e7784068d6537e84fa1a137d4c5
|
7
|
+
data.tar.gz: c8d0f9e3a39c50d092ad760be640416c41e401e2c2a73b93896bac682131945044689935d1658bb39a205b07ce185a93f30de49f9febd64ad18b6f4226a1be6b
|
data/README.md
CHANGED
@@ -54,6 +54,8 @@ is _building_ URIs. It is very convenient to use inside
|
|
54
54
|
|
55
55
|
That's it.
|
56
56
|
|
57
|
+
PS. See how I use it in this Sinatra web app: [yegor256/0rsk](https://github.com/yegor256/0rsk).
|
58
|
+
|
57
59
|
## How to contribute
|
58
60
|
|
59
61
|
Read [these guidelines](https://www.yegor256.com/2014/04/15/github-guidelines.html).
|
data/iri.gemspec
CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |s|
|
|
31
31
|
s.rubygems_version = '2.5'
|
32
32
|
s.required_ruby_version = '>=2.5'
|
33
33
|
s.name = 'iri'
|
34
|
-
s.version = '0.4.
|
34
|
+
s.version = '0.4.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 \
|
data/lib/iri.rb
CHANGED
@@ -137,7 +137,7 @@ class Iri
|
|
137
137
|
# Replace the fragment part of the URI.
|
138
138
|
def fragment(val)
|
139
139
|
modify do |c|
|
140
|
-
c.fragment = val
|
140
|
+
c.fragment = val.to_s
|
141
141
|
end
|
142
142
|
end
|
143
143
|
|
@@ -168,7 +168,7 @@ class Iri
|
|
168
168
|
# The result will contain "https://google.com/a/b/hello?q=test".
|
169
169
|
def append(part)
|
170
170
|
modify do |c|
|
171
|
-
c.path = c.path + '/' + CGI.escape(part)
|
171
|
+
c.path = c.path + '/' + CGI.escape(part.to_s)
|
172
172
|
end
|
173
173
|
end
|
174
174
|
|
data/test/test_iri.rb
CHANGED
@@ -73,8 +73,12 @@ class IriTest < Minitest::Test
|
|
73
73
|
|
74
74
|
def test_replaces_fragment
|
75
75
|
assert_equal(
|
76
|
-
'http://localhost/a/b#test',
|
77
|
-
Iri.new('http://localhost/a/b#before').fragment('test').to_s
|
76
|
+
'http://localhost/a/b#test%20me',
|
77
|
+
Iri.new('http://localhost/a/b#before').fragment('test me').to_s
|
78
|
+
)
|
79
|
+
assert_equal(
|
80
|
+
'http://localhost/#42',
|
81
|
+
Iri.new('http://localhost/').fragment(42).to_s
|
78
82
|
)
|
79
83
|
end
|
80
84
|
|
@@ -92,7 +96,7 @@ class IriTest < Minitest::Test
|
|
92
96
|
)
|
93
97
|
end
|
94
98
|
|
95
|
-
def
|
99
|
+
def test_removes_path
|
96
100
|
assert_equal(
|
97
101
|
'http://localhost/',
|
98
102
|
Iri.new('http://localhost/hey?i=8#test').cut.to_s
|
@@ -119,8 +123,8 @@ class IriTest < Minitest::Test
|
|
119
123
|
|
120
124
|
def test_appends_path
|
121
125
|
assert_equal(
|
122
|
-
'http://google/a/b/z+%2F+7?x=3',
|
123
|
-
Iri.new('http://google/a/b?x=3').append('z / 7').to_s
|
126
|
+
'http://google/a/b/z+%2F+7/42?x=3',
|
127
|
+
Iri.new('http://google/a/b?x=3').append('z / 7').append(42).to_s
|
124
128
|
)
|
125
129
|
end
|
126
130
|
|
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.
|
4
|
+
version: 0.4.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: 2019-05-
|
11
|
+
date: 2019-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|