iri 0.11.4 → 0.11.6

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +0 -1
  3. data/iri.gemspec +2 -2
  4. data/lib/iri.rb +9 -8
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 954071d3530c678879761bb88cb8b62b9cec4d2859fbd1b3eea21e030d412a5e
4
- data.tar.gz: 4d1076ef2dd1bc1ef804a5df31793d45e021140e98ecf5cc5c80677a48e5f96f
3
+ metadata.gz: 7aa1c497498e2f86717f3424aa2ffff883cd0bb802ebd1221eb843bfa9201128
4
+ data.tar.gz: f21579dec4e4f8b10f154346573ec9d315b110af646a038995ad1b0df2835c6f
5
5
  SHA512:
6
- metadata.gz: 56abcf6044957b2cabecb1f4b63e405514cb2fd9143a387d0e47678470fe4fe7cf178ee681737cf6c93a48ea0cbf23866d5a73b85f216ce365b01106da15ebee
7
- data.tar.gz: '0488f1643bfe812abcd6bd387117060d18b1c5612b675af76a52a2b9b83f620565ca4dd944132405773cb6f749b274813d70d345c300a0db86ef6a1dc1327a56'
6
+ metadata.gz: 787968f9c7351661b0ebda1b7f1e682092c7606e8c55a1b666793c05765d6c94aaa6a57d45e608fb914d2485de4d3e3b54221b3400346a9a6ef9f157edc68c32
7
+ data.tar.gz: 3904c3fa693beba0593d1b3920d819b6aceb4c1f82b5bc47d9637edffa83e2ad45b9e18102c3e256e5eadd00d5847b40cb4ba267b106901e7aea66d88159d64f
data/README.md CHANGED
@@ -6,7 +6,6 @@
6
6
 
7
7
  [![rake](https://github.com/yegor256/iri/actions/workflows/rake.yml/badge.svg)](https://github.com/yegor256/iri/actions/workflows/rake.yml)
8
8
  [![Gem Version](https://badge.fury.io/rb/iri.svg)](https://badge.fury.io/rb/iri)
9
- [![Maintainability](https://api.codeclimate.com/v1/badges/7018d2fe438103828685/maintainability)](https://codeclimate.com/github/yegor256/iri/maintainability)
10
9
  [![Yard Docs](https://img.shields.io/badge/yard-docs-blue.svg)](https://rubydoc.info/github/yegor256/iri/master/frames)
11
10
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/yegor256/iri/blob/master/LICENSE.txt)
12
11
  [![Test Coverage](https://img.shields.io/codecov/c/github/yegor256/iri.svg)](https://codecov.io/github/yegor256/iri?branch=master)
data/iri.gemspec CHANGED
@@ -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.4'
12
+ s.version = '0.11.6'
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 for reuse.'
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
@@ -219,7 +219,7 @@ class Iri
219
219
  raise ArgumentError, "The scheme can't be nil" if val.nil?
220
220
  val = val.to_s
221
221
  raise ArgumentError, "The scheme can't be empty" if val.empty?
222
- modify do |c|
222
+ modify(local: false) do |c|
223
223
  c.scheme = val
224
224
  end
225
225
  end
@@ -238,7 +238,7 @@ class Iri
238
238
  raise ArgumentError, "The host can't be nil" if val.nil?
239
239
  val = val.to_s
240
240
  raise ArgumentError, "The host can't be empty" if val.empty?
241
- modify do |c|
241
+ modify(local: false) do |c|
242
242
  c.host = val
243
243
  end
244
244
  end
@@ -259,7 +259,7 @@ class Iri
259
259
  raise ArgumentError, "The port can'be negative" if val.negative?
260
260
  raise ArgumentError, "The port can'be zero" if val.zero?
261
261
  raise ArgumentError, "The port can'be larger than 65536" if val > 65_536
262
- modify do |c|
262
+ modify(local: false) do |c|
263
263
  c.port = val
264
264
  end
265
265
  end
@@ -346,9 +346,10 @@ class Iri
346
346
  path = path.to_s
347
347
  raise ArgumentError, "The path can't be empty" if path.empty?
348
348
  modify do |c|
349
- c.query = nil
350
- c.path = path
351
- c.fragment = nil
349
+ s = Iri.new(path).to_uri
350
+ c.query = s.query
351
+ c.path = s.path
352
+ c.fragment = s.fragment
352
353
  end
353
354
  end
354
355
 
@@ -406,10 +407,10 @@ class Iri
406
407
  #
407
408
  # @yield [URI] The cloned URI object for modification
408
409
  # @return [Iri] A new Iri instance with the modified URI
409
- def modify
410
+ def modify(local: @local, safe: @safe)
410
411
  c = the_uri.clone
411
412
  yield c
412
- Iri.new(c, local: @local, safe: @safe)
413
+ Iri.new(c, local: local, safe: safe)
413
414
  end
414
415
 
415
416
  # Creates a new Iri object after modifying the query parameters.
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
4
+ version: 0.11.6
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 for reuse.
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: []