addressable 2.5.2 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of addressable might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 609a17c9f46ce684482d241232f11a9b9fc81c81
4
- data.tar.gz: 5d2febfcf1ecfc3deafe09afb18f8d423a917597
3
+ metadata.gz: afa411655b3715e655e0cdca551d20df31b83491
4
+ data.tar.gz: 0cd2871c45abb19f6b6238ad202856e7afb8619d
5
5
  SHA512:
6
- metadata.gz: c2643f4006865f0d7654ed88b925bd46a75fc3fc3eaf46dea2b7a57f72ffe7c2b90560bae9ce06ecca4d4a528db4fb8a28e24fdd882bc5d602177d2099ec1b6f
7
- data.tar.gz: 2dcaa8fad9dfe031485391dec12e42bd9a45e105a1486c8e1ba9faeaa6f3600f9742b43e557776bfec9424c16e0dd0a1e22bc219da0e8c80559bfcf04ac405d8
6
+ metadata.gz: 16274bd51d38c58b3712dbbdad1368417051937dbe33d74fa73951a39b71d824092c0ecd50005d467db9c914cc074fd0344282df2e23e1182c764b1a1da9750a
7
+ data.tar.gz: c53ff1d0e09a5e3d997a13a464d50c45fd7d548326f94d3ad40dc97753ce3a47aad4804a62faea48b89775394538982e70ac22d7488fab8ee6594b6816d8ff28
@@ -1,3 +1,14 @@
1
+ # Addressable 2.6.0
2
+ - added `tld=` method to allow assignment to the public suffix
3
+ - most `heuristic_parse` patterns are now case-insensitive
4
+ - `heuristic_parse` handles more `file://` URI variations
5
+ - fixes bug in `heuristic_parse` when uri starts with digit
6
+ - fixes bug in `request_uri=` with query strings
7
+ - fixes template issues with `nil` and `?` operator
8
+ - `frozen_string_literal` pragmas added
9
+ - minor performance improvements in regexps
10
+ - fixes to eliminate warnings
11
+
1
12
  # Addressable 2.5.2
2
13
  - better support for frozen string literals
3
14
  - fixed bug w/ uppercase characters in scheme
data/Gemfile CHANGED
@@ -3,7 +3,7 @@ source 'https://rubygems.org'
3
3
  gemspec
4
4
 
5
5
  group :test do
6
- gem 'rspec', '~> 3.0'
6
+ gem 'rspec', '~> 3.5'
7
7
  gem 'rspec-its', '~> 1.1'
8
8
  end
9
9
 
data/README.md CHANGED
@@ -9,13 +9,11 @@
9
9
 
10
10
  [![Gem Version](http://img.shields.io/gem/dt/addressable.svg)][gem]
11
11
  [![Build Status](https://secure.travis-ci.org/sporkmonger/addressable.svg?branch=master)][travis]
12
- [![Dependency Status](https://gemnasium.com/sporkmonger/addressable.svg?travis)][gemnasium]
13
12
  [![Test Coverage Status](https://img.shields.io/coveralls/sporkmonger/addressable.svg)][coveralls]
14
13
  [![Documentation Coverage Status](http://inch-ci.org/github/sporkmonger/addressable.svg?branch=master)][inch]
15
14
 
16
15
  [gem]: https://rubygems.org/gems/addressable
17
16
  [travis]: http://travis-ci.org/sporkmonger/addressable
18
- [gemnasium]: https://gemnasium.com/sporkmonger/addressable
19
17
  [coveralls]: https://coveralls.io/r/sporkmonger/addressable
20
18
  [inch]: http://inch-ci.org/github/sporkmonger/addressable
21
19
 
@@ -58,7 +56,7 @@ For more details, see [RFC 6570](https://www.rfc-editor.org/rfc/rfc6570.txt).
58
56
 
59
57
  require "addressable/template"
60
58
 
61
- template = Addressable::Template.new("http://example.com/{?query*}/")
59
+ template = Addressable::Template.new("http://example.com/{?query*}")
62
60
  template.expand({
63
61
  "query" => {
64
62
  'foo' => 'bar',
@@ -105,7 +103,7 @@ $ gem install idn-ruby
105
103
 
106
104
  # Semantic Versioning
107
105
 
108
- This project uses sementic versioning. You can (and should) specify your
106
+ This project uses [Semantic Versioning](https://semver.org/). You can (and should) specify your
109
107
  dependency using a pessimistic version constraint covering the major and minor
110
108
  values:
111
109
 
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rubygems'
2
4
  require 'rake'
3
5
 
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'addressable/uri'
2
4
  require 'addressable/template'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # encoding:utf-8
2
4
  #--
3
5
  # Copyright (C) Bob Aman
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # encoding:utf-8
2
4
  #--
3
5
  # Copyright (C) Bob Aman
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # encoding:utf-8
2
4
  #--
3
5
  # Copyright (C) Bob Aman
@@ -146,16 +148,13 @@ module Addressable
146
148
  starter_cc = 256 if starter_cc != 0
147
149
  for i in 1...length
148
150
  ch = unpacked[i]
149
- cc = lookup_unicode_combining_class(ch)
150
151
 
151
152
  if (starter_cc == 0 &&
152
153
  (composite = unicode_compose_pair(starter, ch)) != nil)
153
154
  starter = composite
154
- startercc = lookup_unicode_combining_class(composite)
155
155
  else
156
156
  unpacked_result << starter
157
157
  starter = ch
158
- startercc = cc
159
158
  end
160
159
  end
161
160
  unpacked_result << starter
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # encoding:utf-8
2
4
  #--
3
5
  # Copyright (C) Bob Aman
@@ -728,54 +730,32 @@ module Addressable
728
730
  normalize_values = true)
729
731
  _, operator, varlist = *capture.match(EXPRESSION)
730
732
 
731
- vars = varlist.split(',')
733
+ vars = varlist.split(",")
732
734
 
733
- if '?' == operator
735
+ if operator == "?"
734
736
  # partial expansion of form style query variables sometimes requires a
735
737
  # slight reordering of the variables to produce a valid url.
736
738
  first_to_expand = vars.find { |varspec|
737
739
  _, name, _ = *varspec.match(VARSPEC)
738
- mapping.key? name
740
+ mapping.key?(name) && !mapping[name].nil?
739
741
  }
740
742
 
741
743
  vars = [first_to_expand] + vars.reject {|varspec| varspec == first_to_expand} if first_to_expand
742
744
  end
743
745
 
744
- vars
745
- .zip(operator_sequence(operator).take(vars.length))
746
- .reduce("".dup) do |acc, (varspec, op)|
746
+ vars.
747
+ inject("".dup) do |acc, varspec|
747
748
  _, name, _ = *varspec.match(VARSPEC)
748
-
749
- acc << if mapping.key? name
750
- transform_capture(mapping, "{#{op}#{varspec}}",
751
- processor, normalize_values)
752
- else
753
- "{#{op}#{varspec}}"
754
- end
755
- end
756
- end
757
-
758
- ##
759
- # Creates a lazy Enumerator of the operators that should be used to expand
760
- # variables in a varlist starting with `operator`. For example, an operator
761
- # `"?"` results in the sequence `"?","&","&"...`
762
- #
763
- # @param [String] operator from which to generate a sequence
764
- #
765
- # @return [Enumerator] sequence of operators
766
- def operator_sequence(operator)
767
- rest_operator = if "?" == operator
768
- "&"
769
- else
770
- operator
771
- end
772
- head_operator = operator
773
-
774
- Enumerator.new do |y|
775
- y << head_operator.to_s
776
- while true
777
- y << rest_operator.to_s
778
- end
749
+ next_val = if mapping.key? name
750
+ transform_capture(mapping, "{#{operator}#{varspec}}",
751
+ processor, normalize_values)
752
+ else
753
+ "{#{operator}#{varspec}}"
754
+ end
755
+ # If we've already expanded at least one '?' operator with non-empty
756
+ # value, change to '&'
757
+ operator = "&" if (operator == "?") && (next_val != "")
758
+ acc << next_val
779
759
  end
780
760
  end
781
761
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # encoding:utf-8
2
4
  #--
3
5
  # Copyright (C) Bob Aman
@@ -122,9 +124,9 @@ module Addressable
122
124
  user = userinfo.strip[/^([^:]*):?/, 1]
123
125
  password = userinfo.strip[/:(.*)$/, 1]
124
126
  end
125
- host = authority.gsub(
127
+ host = authority.sub(
126
128
  /^([^\[\]]*)@/, EMPTY_STR
127
- ).gsub(
129
+ ).sub(
128
130
  /:([^:@\[\]]*?)$/, EMPTY_STR
129
131
  )
130
132
  port = authority[/:([^:@\[\]]*?)$/, 1]
@@ -182,18 +184,24 @@ module Addressable
182
184
  :scheme => "http"
183
185
  }.merge(hints)
184
186
  case uri
185
- when /^http:\/+/
186
- uri.gsub!(/^http:\/+/, "http://")
187
- when /^https:\/+/
188
- uri.gsub!(/^https:\/+/, "https://")
189
- when /^feed:\/+http:\/+/
190
- uri.gsub!(/^feed:\/+http:\/+/, "feed:http://")
191
- when /^feed:\/+/
192
- uri.gsub!(/^feed:\/+/, "feed://")
193
- when /^file:\/+/
194
- uri.gsub!(/^file:\/+/, "file:///")
187
+ when /^http:\//i
188
+ uri.sub!(/^http:\/+/i, "http://")
189
+ when /^https:\//i
190
+ uri.sub!(/^https:\/+/i, "https://")
191
+ when /^feed:\/+http:\//i
192
+ uri.sub!(/^feed:\/+http:\/+/i, "feed:http://")
193
+ when /^feed:\//i
194
+ uri.sub!(/^feed:\/+/i, "feed://")
195
+ when %r[^file:/{4}]i
196
+ uri.sub!(%r[^file:/+]i, "file:////")
197
+ when %r[^file://localhost/]i
198
+ uri.sub!(%r[^file://localhost/+]i, "file:///")
199
+ when %r[^file:/+]i
200
+ uri.sub!(%r[^file:/+]i, "file:///")
195
201
  when /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/
196
- uri.gsub!(/^/, hints[:scheme] + "://")
202
+ uri.sub!(/^/, hints[:scheme] + "://")
203
+ when /\A\d+\..*:\d+\z/
204
+ uri = "#{hints[:scheme]}://#{uri}"
197
205
  end
198
206
  match = uri.match(URIREGEX)
199
207
  fragments = match.captures
@@ -202,6 +210,7 @@ module Addressable
202
210
  new_authority = authority.gsub(/\\/, '/').gsub(/ /, '%20')
203
211
  # NOTE: We want offset 4, not 3!
204
212
  offset = match.offset(4)
213
+ uri = uri.dup
205
214
  uri[offset[0]...offset[1]] = new_authority
206
215
  end
207
216
  parsed = self.parse(uri)
@@ -212,7 +221,7 @@ module Addressable
212
221
  new_host = parsed.path[/^([^\/]+\.[^\/]*)/, 1]
213
222
  if new_host
214
223
  parsed.defer_validation do
215
- new_path = parsed.path.gsub(
224
+ new_path = parsed.path.sub(
216
225
  Regexp.new("^" + Regexp.escape(new_host)), EMPTY_STR)
217
226
  parsed.host = new_host
218
227
  parsed.path = new_path
@@ -263,19 +272,19 @@ module Addressable
263
272
  # Otherwise, convert to a String
264
273
  path = path.to_str.strip
265
274
 
266
- path.gsub!(/^file:\/?\/?/, EMPTY_STR) if path =~ /^file:\/?\/?/
275
+ path.sub!(/^file:\/?\/?/, EMPTY_STR) if path =~ /^file:\/?\/?/
267
276
  path = SLASH + path if path =~ /^([a-zA-Z])[\|:]/
268
277
  uri = self.parse(path)
269
278
 
270
279
  if uri.scheme == nil
271
280
  # Adjust windows-style uris
272
- uri.path.gsub!(/^\/?([a-zA-Z])[\|:][\\\/]/) do
281
+ uri.path.sub!(/^\/?([a-zA-Z])[\|:][\\\/]/) do
273
282
  "/#{$1.downcase}:/"
274
283
  end
275
284
  uri.path.gsub!(/\\/, SLASH)
276
285
  if File.exist?(uri.path) &&
277
286
  File.stat(uri.path).directory?
278
- uri.path.gsub!(/\/$/, EMPTY_STR)
287
+ uri.path.sub!(/\/$/, EMPTY_STR)
279
288
  uri.path = uri.path + '/'
280
289
  end
281
290
 
@@ -1168,6 +1177,15 @@ module Addressable
1168
1177
  PublicSuffix.parse(self.host, ignore_private: true).tld
1169
1178
  end
1170
1179
 
1180
+ ##
1181
+ # Sets the top-level domain for this URI.
1182
+ #
1183
+ # @param [String, #to_str] new_tld The new top-level domain.
1184
+ def tld=(new_tld)
1185
+ replaced_tld = domain.sub(/#{tld}\z/, new_tld)
1186
+ self.host = PublicSuffix::Domain.new(replaced_tld).to_s
1187
+ end
1188
+
1171
1189
  ##
1172
1190
  # Returns the public suffix domain for this host.
1173
1191
  #
@@ -1235,9 +1253,9 @@ module Addressable
1235
1253
  new_user = new_userinfo.strip[/^([^:]*):?/, 1]
1236
1254
  new_password = new_userinfo.strip[/:(.*)$/, 1]
1237
1255
  end
1238
- new_host = new_authority.gsub(
1256
+ new_host = new_authority.sub(
1239
1257
  /^([^\[\]]*)@/, EMPTY_STR
1240
- ).gsub(
1258
+ ).sub(
1241
1259
  /:([^:@\[\]]*?)$/, EMPTY_STR
1242
1260
  )
1243
1261
  new_port =
@@ -1544,7 +1562,7 @@ module Addressable
1544
1562
  # @return [String] The path's basename.
1545
1563
  def basename
1546
1564
  # Path cannot be nil
1547
- return File.basename(self.path).gsub(/;[^\/]*$/, EMPTY_STR)
1565
+ return File.basename(self.path).sub(/;[^\/]*$/, EMPTY_STR)
1548
1566
  end
1549
1567
 
1550
1568
  ##
@@ -1744,7 +1762,7 @@ module Addressable
1744
1762
  "Cannot set an HTTP request URI for a non-HTTP URI."
1745
1763
  end
1746
1764
  new_request_uri = new_request_uri.to_str
1747
- path_component = new_request_uri[/^([^\?]*)\?(?:.*)$/, 1]
1765
+ path_component = new_request_uri[/^([^\?]*)\??(?:.*)$/, 1]
1748
1766
  query_component = new_request_uri[/^(?:[^\?]*)\?(.*)$/, 1]
1749
1767
  path_component = path_component.to_s
1750
1768
  path_component = (!path_component.empty? ? path_component : SLASH)
@@ -1900,7 +1918,7 @@ module Addressable
1900
1918
  #
1901
1919
  # Removes the right-most path segment from the base path.
1902
1920
  if base_path =~ /\//
1903
- base_path.gsub!(/\/[^\/]+$/, SLASH)
1921
+ base_path.sub!(/\/[^\/]+$/, SLASH)
1904
1922
  else
1905
1923
  base_path = EMPTY_STR
1906
1924
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # encoding:utf-8
2
4
  #--
3
5
  # Copyright (C) Bob Aman
@@ -21,8 +23,8 @@ if !defined?(Addressable::VERSION)
21
23
  module Addressable
22
24
  module VERSION
23
25
  MAJOR = 2
24
- MINOR = 5
25
- TINY = 2
26
+ MINOR = 6
27
+ TINY = 0
26
28
 
27
29
  STRING = [MAJOR, MINOR, TINY].join('.')
28
30
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # coding: utf-8
2
4
  # Copyright (C) Bob Aman
3
5
  #
@@ -26,9 +28,9 @@ shared_examples_for "converting from unicode to ASCII" do
26
28
  expect(Addressable::IDNA.to_ascii("www.google.com")).to eq("www.google.com")
27
29
  end
28
30
 
29
- LONG = 'AcinusFallumTrompetumNullunCreditumVisumEstAtCuadLongumEtCefallum.com'
30
- it "should convert '#{LONG}' correctly" do
31
- expect(Addressable::IDNA.to_ascii(LONG)).to eq(LONG)
31
+ long = 'AcinusFallumTrompetumNullunCreditumVisumEstAtCuadLongumEtCefallum.com'
32
+ it "should convert '#{long}' correctly" do
33
+ expect(Addressable::IDNA.to_ascii(long)).to eq(long)
32
34
  end
33
35
 
34
36
  it "should convert 'www.詹姆斯.com' correctly" do
@@ -148,9 +150,9 @@ shared_examples_for "converting from unicode to ASCII" do
148
150
  end
149
151
 
150
152
  shared_examples_for "converting from ASCII to unicode" do
151
- LONG = 'AcinusFallumTrompetumNullunCreditumVisumEstAtCuadLongumEtCefallum.com'
152
- it "should convert '#{LONG}' correctly" do
153
- expect(Addressable::IDNA.to_unicode(LONG)).to eq(LONG)
153
+ long = 'AcinusFallumTrompetumNullunCreditumVisumEstAtCuadLongumEtCefallum.com'
154
+ it "should convert '#{long}' correctly" do
155
+ expect(Addressable::IDNA.to_unicode(long)).to eq(long)
154
156
  end
155
157
 
156
158
  it "should return the identity conversion when punycode decode fails" do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # coding: utf-8
2
4
  # Copyright (C) Bob Aman
3
5
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # coding: utf-8
2
4
  # Copyright (C) Bob Aman
3
5
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # coding: utf-8
2
4
  # Copyright (C) Bob Aman
3
5
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # coding: utf-8
2
4
  # Copyright (C) Bob Aman
3
5
  #
@@ -82,7 +84,7 @@ describe "Type conversion" do
82
84
  :hello => 1234,
83
85
  :nothing => nil,
84
86
  :sym => :symbolic,
85
- :decimal => BigDecimal.new('1')
87
+ :decimal => BigDecimal('1')
86
88
  }
87
89
  }
88
90
 
@@ -949,6 +951,36 @@ describe Addressable::Template do
949
951
  )
950
952
  end
951
953
  end
954
+ context "issue #307 - partial_expand form query with nil params" do
955
+ subject do
956
+ Addressable::Template.new("http://example.com/{?one,two,three}/")
957
+ end
958
+ it "builds a new pattern with two=nil" do
959
+ expect(subject.partial_expand(two: nil).pattern).to eq(
960
+ "http://example.com/{?one}{&three}/"
961
+ )
962
+ end
963
+ it "builds a new pattern with one=nil and two=nil" do
964
+ expect(subject.partial_expand(one: nil, two: nil).pattern).to eq(
965
+ "http://example.com/{?three}/"
966
+ )
967
+ end
968
+ it "builds a new pattern with one=1 and two=nil" do
969
+ expect(subject.partial_expand(one: 1, two: nil).pattern).to eq(
970
+ "http://example.com/?one=1{&three}/"
971
+ )
972
+ end
973
+ it "builds a new pattern with one=nil and two=2" do
974
+ expect(subject.partial_expand(one: nil, two: 2).pattern).to eq(
975
+ "http://example.com/?two=2{&three}/"
976
+ )
977
+ end
978
+ it "builds a new pattern with one=nil" do
979
+ expect(subject.partial_expand(one: nil).pattern).to eq(
980
+ "http://example.com/{?two}{&three}/"
981
+ )
982
+ end
983
+ end
952
984
  context "partial_expand with query string" do
953
985
  subject {
954
986
  Addressable::Template.new("http://example.com/{?two,one}/")
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # coding: utf-8
2
4
  # Copyright (C) Bob Aman
3
5
  #
@@ -1984,6 +1986,20 @@ describe Addressable::URI, "when parsed from " +
1984
1986
  expect(@uri.request_uri).to eq("/pub/WWW/TheProject.html")
1985
1987
  end
1986
1988
 
1989
+ it "should have the correct request URI after assignment" do
1990
+ @uri.request_uri = "/pub/WWW/TheProject.html?"
1991
+ expect(@uri.request_uri).to eq("/pub/WWW/TheProject.html?")
1992
+ expect(@uri.path).to eq("/pub/WWW/TheProject.html")
1993
+ expect(@uri.query).to eq("")
1994
+ end
1995
+
1996
+ it "should have the correct request URI after assignment" do
1997
+ @uri.request_uri = "/some/where/else.html"
1998
+ expect(@uri.request_uri).to eq("/some/where/else.html")
1999
+ expect(@uri.path).to eq("/some/where/else.html")
2000
+ expect(@uri.query).to eq(nil)
2001
+ end
2002
+
1987
2003
  it "should have the correct request URI after assignment" do
1988
2004
  @uri.request_uri = "/some/where/else.html?query?string"
1989
2005
  expect(@uri.request_uri).to eq("/some/where/else.html?query?string")
@@ -5490,6 +5506,31 @@ describe Addressable::URI, "when given the path '/one/two/'" do
5490
5506
  end
5491
5507
  end
5492
5508
 
5509
+ describe Addressable::URI, "when given the tld " do
5510
+ it "'uk' should have a tld of 'uk'" do
5511
+ uri = Addressable::URI.parse("http://example.com")
5512
+ uri.tld = "uk"
5513
+
5514
+ expect(uri.tld).to eq("uk")
5515
+ end
5516
+
5517
+ context "which " do
5518
+ let (:uri) { Addressable::URI.parse("http://comrade.net/path/to/source/") }
5519
+
5520
+ it "contains a subdomain" do
5521
+ uri.tld = "co.uk"
5522
+
5523
+ expect(uri.to_s).to eq("http://comrade.co.uk/path/to/source/")
5524
+ end
5525
+
5526
+ it "is part of the domain" do
5527
+ uri.tld = "com"
5528
+
5529
+ expect(uri.to_s).to eq("http://comrade.com/path/to/source/")
5530
+ end
5531
+ end
5532
+ end
5533
+
5493
5534
  describe Addressable::URI, "when given the path " +
5494
5535
  "'c:\\windows\\My Documents 100%20\\foo.txt'" do
5495
5536
  before do
@@ -6227,6 +6268,18 @@ describe Addressable::URI, "when given the input " +
6227
6268
  end
6228
6269
  end
6229
6270
 
6271
+ describe Addressable::URI, "when given the input which "\
6272
+ "start with digits and has specified port" do
6273
+ before do
6274
+ @input = "7777.example.org:8089"
6275
+ end
6276
+
6277
+ it "should heuristically parse to 'http://7777.example.org:8089'" do
6278
+ uri = Addressable::URI.heuristic_parse(@input)
6279
+ expect(uri.to_s).to eq("http://7777.example.org:8089")
6280
+ end
6281
+ end
6282
+
6230
6283
  describe Addressable::URI, "when given the input " +
6231
6284
  "'feed:///example.com'" do
6232
6285
  before do
@@ -6239,6 +6292,18 @@ describe Addressable::URI, "when given the input " +
6239
6292
  end
6240
6293
  end
6241
6294
 
6295
+ describe Addressable::URI, "when given the input " +
6296
+ "'file://localhost/path/to/resource/'" do
6297
+ before do
6298
+ @input = "file://localhost/path/to/resource/"
6299
+ end
6300
+
6301
+ it "should heuristically parse to 'file:///path/to/resource/'" do
6302
+ @uri = Addressable::URI.heuristic_parse(@input)
6303
+ expect(@uri.to_s).to eq("file:///path/to/resource/")
6304
+ end
6305
+ end
6306
+
6242
6307
  describe Addressable::URI, "when given the input " +
6243
6308
  "'file://path/to/resource/'" do
6244
6309
  before do
@@ -6251,6 +6316,18 @@ describe Addressable::URI, "when given the input " +
6251
6316
  end
6252
6317
  end
6253
6318
 
6319
+ describe Addressable::URI, "when given the input " +
6320
+ "'file://///path/to/resource/'" do
6321
+ before do
6322
+ @input = "file:///////path/to/resource/"
6323
+ end
6324
+
6325
+ it "should heuristically parse to 'file:////path/to/resource/'" do
6326
+ @uri = Addressable::URI.heuristic_parse(@input)
6327
+ expect(@uri.to_s).to eq("file:////path/to/resource/")
6328
+ end
6329
+ end
6330
+
6254
6331
  describe Addressable::URI, "when given the input " +
6255
6332
  "'feed://http://example.com'" do
6256
6333
  before do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/setup'
2
4
  require 'rspec/its'
3
5
 
@@ -18,4 +20,5 @@ end
18
20
 
19
21
  RSpec.configure do |config|
20
22
  config.warnings = true
23
+ config.filter_run_when_matching :focus
21
24
  end
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  desc "Remove all build products"
2
4
  task "clobber"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "rubygems/package_task"
2
4
 
3
5
  namespace :gem do
@@ -21,7 +23,7 @@ namespace :gem do
21
23
  s.required_ruby_version = '>= 2.0'
22
24
 
23
25
  s.add_runtime_dependency 'public_suffix', '>= 2.0.2', '< 4.0'
24
- s.add_development_dependency 'bundler', '~> 1.0'
26
+ s.add_development_dependency 'bundler', '>= 1.0', '< 3.0'
25
27
 
26
28
  s.require_path = "lib"
27
29
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  namespace :git do
2
4
  namespace :tag do
3
5
  desc "List tags from the Git repository"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  namespace :metrics do
2
4
  task :lines do
3
5
  lines, codelines, total_lines, total_codelines = 0, 0, 0, 0
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "rspec/core/rake_task"
2
4
 
3
5
  namespace :spec do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "rake"
2
4
 
3
5
  begin
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: addressable
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.2
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bob Aman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-25 00:00:00.000000000 Z
11
+ date: 2019-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: public_suffix
@@ -34,16 +34,22 @@ dependencies:
34
34
  name: bundler
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - "~>"
37
+ - - ">="
38
38
  - !ruby/object:Gem::Version
39
39
  version: '1.0'
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: '3.0'
40
43
  type: :development
41
44
  prerelease: false
42
45
  version_requirements: !ruby/object:Gem::Requirement
43
46
  requirements:
44
- - - "~>"
47
+ - - ">="
45
48
  - !ruby/object:Gem::Version
46
49
  version: '1.0'
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '3.0'
47
53
  description: |
48
54
  Addressable is a replacement for the URI implementation that is part of
49
55
  Ruby's standard library. It more closely conforms to the relevant RFCs and