uri-query_params 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -12,7 +12,7 @@ rescue LoadError => e
12
12
  end
13
13
 
14
14
  begin
15
- gem 'rspec', '~> 2.0.0'
15
+ gem 'rspec', '~> 2.1.0'
16
16
  require 'rspec/core/rake_task'
17
17
 
18
18
  RSpec::Core::RakeTask.new
data/gemspec.yml CHANGED
@@ -9,5 +9,5 @@ has_yard: true
9
9
 
10
10
  development_dependencies:
11
11
  ore-tasks: ~> 0.2.0
12
- rspec: ~> 2.0.0
12
+ rspec: ~> 2.1.0
13
13
  yard: ~> 0.6.0
@@ -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
  #
@@ -1,6 +1,6 @@
1
1
  module URI
2
2
  module QueryParams
3
3
  # uri-query_params version
4
- VERSION = '0.5.0'
4
+ VERSION = '0.5.1'
5
5
  end
6
6
  end
@@ -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
@@ -1,4 +1,4 @@
1
1
  require 'rubygems'
2
2
 
3
- gem 'rspec', '~> 2.0.0'
3
+ gem 'rspec', '~> 2.1.0'
4
4
  require 'rspec'
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 5
8
- - 0
9
- version: 0.5.0
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-07 00:00:00 -07:00
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
- - 0
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