furi 0.2.6 → 0.2.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8522bcc3d1b7e9982f6ccca4bd91a97df9fd3c7ca0ec45c40ae345dadf6b5f63
4
- data.tar.gz: e7f046f02b324bbd940b85cf4c061e951828561791bfba1a8b487eb53caa5695
3
+ metadata.gz: 5923ee7cbb73b1b035612324a274790d95ec2cef4369558fc6874e28da4fe77b
4
+ data.tar.gz: bebdc6c2ab8ae6b5a8cc262c2c70d53a8d1721020fcd7581a713f9f2f629b010
5
5
  SHA512:
6
- metadata.gz: dc5a921d62aceec5937b8f409a065252fe7a80f2c5ffc282f9d7a20f605445a86bd6047f103815b383af6ee63c66966af8aeff6a313da6d7c97fe640119728e5
7
- data.tar.gz: 057a89a20fa245d2f93757e9b963f21d763c380836627cf3a2061f37e8fcbc5e61091cf1025537abcde23858275fa2fdd9f7000aa97800359e998b84c47ad57a
6
+ metadata.gz: 9b9a3c1d0116faa7828205294fc22b6eb2045536ffdd3c3665d7d8ea8dc4de3ac88bd43904f82c9c33948e943c073e9c0a44dc5a6c6a80e4b30252fd690b49f4
7
+ data.tar.gz: 5ef899e9301205592801d7f037d7193d4f1f13c057198fa3eff06e559e86bcdb8b209df0e77e24aad04f8d555ff4aaf443e8373adc3f79dc17360c24e330787a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # v0.2.7
2
+
3
+ * Add `origin` part (location + path, without query string and anchor)
4
+
5
+ ```ruby
6
+ Furi.parse("http://gusiev.com/articles/index.html?a=1#top").origin
7
+ # => "http://gusiev.com/articles/index.html"
8
+
9
+ Furi.replace("http://gusiev.com/index.html?a=1#top", origin: "http://gusiev.com/blog.html")
10
+ # => "http://gusiev.com/blog.html?a=1#top"
11
+ ```
12
+
1
13
  # v0.2.6
2
14
 
3
15
  * Support `filename` part replacement and extraction
data/lib/furi/uri.rb CHANGED
@@ -207,6 +207,18 @@ module Furi
207
207
  end
208
208
  end
209
209
 
210
+ def origin
211
+ [location, path].join
212
+ end
213
+
214
+ def origin=(string)
215
+ string ||= ""
216
+ string = parse_protocol(string)
217
+ authority, path = string.split("/", 2)
218
+ self.authority = authority
219
+ self.path = path ? "/#{path}" : nil
220
+ end
221
+
210
222
  def location=(string)
211
223
  string ||= ""
212
224
  string = string.gsub(%r(/\Z), '')
data/lib/furi/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Furi
2
- VERSION = "0.2.6"
2
+ VERSION = "0.2.7"
3
3
  end
data/lib/furi.rb CHANGED
@@ -15,7 +15,7 @@ module Furi
15
15
 
16
16
  COMBINED_PARTS = [
17
17
  :hostinfo, :userinfo, :authority, :ssl, :domain, :domainname,
18
- :domainzone, :request, :location, :query,
18
+ :domainzone, :request, :location, :origin, :query,
19
19
  :directory, :extension, :file
20
20
  ]
21
21
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: furi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bogdan Gusiev