patch_utils 1.0.4 → 1.0.5

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
  SHA1:
3
- metadata.gz: 77391893a4f0b281ff0d8366f7b7354b7fa98369
4
- data.tar.gz: 8f8d907c8a235c9669428d9f27d10149f95a0a19
3
+ metadata.gz: 4866f48f02e9428802690d2b0908b69115e642cb
4
+ data.tar.gz: 080efd8e0a90abcf3a86891b654a96f2c79affcc
5
5
  SHA512:
6
- metadata.gz: f884c30b84c1ef4e4d1ab528fc03750744b2e1d8b48004cf3d1d16e9b5b8864ca8a640bdeb3345e9c813b3d74764d157ce499b8527732156defa5c7cf6f75cfe
7
- data.tar.gz: cdb8a30d3145c06cb33957947b36a64fad4267f2f518396c0b4f96305cd623a667bee4d6887ad57a892bb06926b5230067213a8a4141797778a57d3abfb699f8
6
+ metadata.gz: b557f95b978f9ecc2b7c42dec9a36d7f8baa21d86e70d9e6d6b957a03f927a4db030996602c491f902c0dc8d6dbdb730f14a807dc7e49f794efe2893f214468c
7
+ data.tar.gz: eae3b445e6229bf71a22b8c423c04fc16a9bd3344c74e8474f98cea518b3b72e79c90a49c8e47794466b614820d9da0ff986639cc3329f1dbcf20cf2f2b6d38b
@@ -25,28 +25,26 @@ class HashDiff
25
25
  end
26
26
 
27
27
  if h1.is_a?(Hash) && h2.is_a?(Hash)
28
- all_keys = (h1.keys | h2.keys)
28
+ same_keys = (h1.keys & h2.keys)
29
29
  from = h1.clone
30
30
  to = h2.clone
31
- all_keys.each do |k|
32
- if h1.keys.include?(k) && h2.keys.include?(k)
33
- if block_given?
34
- if yield(h1[k], h2[k])
35
- from.delete(k)
36
- to.delete(k)
37
- end
38
- else
39
- if h1[k] == h2[k]
40
- from.delete(k)
41
- to.delete(k)
42
- end
31
+ same_keys.each do |k|
32
+ if block_given?
33
+ if yield(h1[k], h2[k])
34
+ from.delete(k)
35
+ to.delete(k)
43
36
  end
44
- _diff = self.get_diff(h1[k], h2[k], &blk)
45
- if _diff.present?
46
- from[k] = _diff[:from]
47
- to[k] = _diff[:to]
37
+ else
38
+ if h1[k] == h2[k]
39
+ from.delete(k)
40
+ to.delete(k)
48
41
  end
49
42
  end
43
+ _diff = self.get_diff(h1[k], h2[k], &blk)
44
+ if _diff.present?
45
+ from[k] = _diff[:from]
46
+ to[k] = _diff[:to]
47
+ end
50
48
  end
51
49
  return {:from => from, :to => to}
52
50
  end
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'patch_utils'
3
- s.version = '1.0.4'
4
- s.date = '2014-12-03'
3
+ s.version = '1.0.5'
4
+ s.date = '2014-12-04'
5
5
  s.summary = "patch_utils by zzqwdss"
6
6
  s.description = "some useful utils and monkey patches"
7
7
  s.authors = ["zzqwdss"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: patch_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - zzqwdss
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-03 00:00:00.000000000 Z
11
+ date: 2014-12-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: some useful utils and monkey patches
14
14
  email: zzqwdss@gmail.com