simple-url 2.0.0 → 2.0.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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/simple_url.rb +11 -1
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 75fe80e4e2f9754c6fe0cf1ae31f26e2166f26ab5c5e14247e63c1359278b76b
4
- data.tar.gz: 408515ec2f5674cda6db29d74c4af2abaa4926149738491fd488f39db808e146
3
+ metadata.gz: 4f285a26b9e2d504e26f7f437948a3ec3952a24568888de6bf5c587c588e4ba6
4
+ data.tar.gz: ca25f47043aa8c5125ff58fd4b1b3458f73974b776c4a6d694188d0b0f018f6f
5
5
  SHA512:
6
- metadata.gz: 075a665718b3d223e562cb746d52fc0b2c9d041cec2441ae374a3951d3c8ddd59a1ea3a343b2cc5132675ed336fb1499e0d944b6bbc3dbcc99cad84c5a892ceb
7
- data.tar.gz: 213fb4d29bc3b99801d38511e4bc470fa1d74ee0390f1e8353d4fbdc70571c5a3eb958b69e00a5dc29b6d2b9fe3988151d0d2dafa029a84a8d7936b6e3b7135c
6
+ metadata.gz: 17344f1276f91eeeed3fcfde6afd5ff59f915253d4467fc0c6d918d6172d5a01d331ab56da9ac97c77094824e68aab7f5ab2cd9230b8984b7eb6477ba6636c2e
7
+ data.tar.gz: 482b2f3f3b8afcf5bd483423268ebb37de5cbdbf21fd3790a164ef0c6e4d5e9b62ac8fdbd6cee7f0846e96075e1382bbd8ef05e737016faf680b2176e785b4ce
data/lib/simple_url.rb CHANGED
@@ -4,18 +4,28 @@ require 'uri'
4
4
 
5
5
  module SimpleUrl
6
6
  class Url
7
- attr_accessor :url, :query
7
+ attr_accessor :url, :path, :query
8
8
  attr_reader :query_string_class
9
9
 
10
10
  def initialize(url, query_string_class)
11
11
  @url = URI(url)
12
+ @path = Pathname.new(@url.path)
12
13
  @query_string_class = query_string_class
13
14
  @query = query_string_class.from_string(@url.query)
14
15
  end
15
16
 
17
+ def append_path(path)
18
+ @path = @path.join(path)
19
+ end
20
+
21
+ def normalize_path
22
+ @path = @path.cleanpath
23
+ end
24
+
16
25
  def to_s
17
26
  q = @query.to_s
18
27
  @url.query = q unless q.empty?
28
+ @url.path = @path.to_s
19
29
  @url.to_s
20
30
  end
21
31
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple-url
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruno Dias