libraries 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -26,7 +26,7 @@ class Hash
26
26
  # Returns hash with keys renamed
27
27
  def rename_keys!(keys_hash)
28
28
  keys_hash.each do |old, new|
29
- self[new] = self.delete(old)
29
+ self[new] = self.delete(old) if self[old]
30
30
  end
31
31
  self
32
32
  end
@@ -1,3 +1,3 @@
1
1
  module Libraries
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -141,6 +141,10 @@ describe Hash do
141
141
  source_hash.rename_keys! :a => :b, 1 => 2, -1 => -2, "a" => "b"
142
142
  source_hash.should == {:b => "Symbol", 2 => "Integer", -2 => 100, "b" => "Text"}
143
143
  end
144
+ it "does not affect destination keys if sources keys do not exist" do
145
+ source_hash.rename_keys! :b => :a, 3 => 1, -1 => -37, "a" => "z", 99 => :x
146
+ source_hash.should == {:a => "Symbol", 1 => "Integer", -37 => 100, "z" => "Text"}
147
+ end
144
148
  end
145
149
 
146
150
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libraries
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - On-Site.com
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-01 00:00:00 -07:00
18
+ date: 2010-11-02 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies: []
21
21