uri-query_params 0.5.0 → 0.5.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.
- data/Rakefile +1 -1
- data/gemspec.yml +1 -1
- data/lib/uri/query_params/mixin.rb +16 -0
- data/lib/uri/query_params/version.rb +1 -1
- data/spec/query_params_mixin_examples.rb +7 -0
- data/spec/spec_helper.rb +1 -1
- metadata +5 -5
data/Rakefile
CHANGED
data/gemspec.yml
CHANGED
@@ -12,6 +12,22 @@ module URI
|
|
12
12
|
# Allows setting the query_params.
|
13
13
|
attr_writer :query_params
|
14
14
|
|
15
|
+
#
|
16
|
+
# Deep-copies the {#query_params} from another URL.
|
17
|
+
#
|
18
|
+
# @param [Mixin] url
|
19
|
+
# The other URL to deep-copy the query_params from.
|
20
|
+
#
|
21
|
+
# @since 0.5.1
|
22
|
+
#
|
23
|
+
def initialize_copy(url)
|
24
|
+
if (params = url.instance_variable_get('@query_params'))
|
25
|
+
@query_params = params.dup
|
26
|
+
end
|
27
|
+
|
28
|
+
super(url)
|
29
|
+
end
|
30
|
+
|
15
31
|
#
|
16
32
|
# Sets the query string and updates query_params.
|
17
33
|
#
|
@@ -29,6 +29,13 @@ shared_examples_for "URI::QueryParams::Mixin" do
|
|
29
29
|
subject.to_s.match(/\?(.+)$/)[1].should == "x=1%262&y=one%3Dtwo&z=%3F"
|
30
30
|
end
|
31
31
|
|
32
|
+
it "should deep-copy the query_params Hash" do
|
33
|
+
original = subject.query_params.object_id
|
34
|
+
|
35
|
+
subject.dup.query_params.object_id.should_not == original
|
36
|
+
subject.clone.query_params.object_id.should_not == original
|
37
|
+
end
|
38
|
+
|
32
39
|
describe "#query_params" do
|
33
40
|
subject { uri.query_params }
|
34
41
|
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 5
|
8
|
-
-
|
9
|
-
version: 0.5.
|
8
|
+
- 1
|
9
|
+
version: 0.5.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Postmodern
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-11-
|
17
|
+
date: 2010-11-11 00:00:00 -08:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -42,9 +42,9 @@ dependencies:
|
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
segments:
|
44
44
|
- 2
|
45
|
+
- 1
|
45
46
|
- 0
|
46
|
-
|
47
|
-
version: 2.0.0
|
47
|
+
version: 2.1.0
|
48
48
|
type: :development
|
49
49
|
version_requirements: *id002
|
50
50
|
- !ruby/object:Gem::Dependency
|