meld 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/meld.rb +1 -1
- data/lib/meld/{deep_hash_merge.rb → hash/deep_merge.rb} +6 -2
- data/meld.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d28b02559c91c8dc55627f5ddbeca8c27d6accb6
|
4
|
+
data.tar.gz: 027e2e81e919e098d51eefc0465101e5af2e2e9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6c8eb2a81ad1bc078ce6bea8b0585701045792747e534691aa676e6e7d2d3cc9fc2c192038452abc9fe5bf98657d0294fcc092dd52b10cf9a96231803ada0e0
|
7
|
+
data.tar.gz: 71720e7ce7e01ef288564df301bd043994a45941d96e356c9d26893ae8507f8c33328104b5df45ff0e76a171cf3aa7c2209dcbd94c9cf23538fb925462450bf8
|
data/lib/meld.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require 'meld/
|
1
|
+
require 'meld/hash/deep_merge'
|
@@ -2,11 +2,15 @@ module Kernel
|
|
2
2
|
# From https://gist.github.com/ku/e17e3d65ec4c37b60149
|
3
3
|
# From http://stackoverflow.com/questions/9381553/ruby-merge-nested-hash
|
4
4
|
class Hash
|
5
|
-
def deep_merge(second)
|
5
|
+
def deep_merge!(second)
|
6
6
|
merger = proc do |_, v1, v2|
|
7
7
|
[v1, v2].all? { |x| x.is_a? Hash } ? v1.merge(v2, &merger) : v2
|
8
8
|
end
|
9
|
-
merge(second, &merger)
|
9
|
+
merge!(second, &merger)
|
10
|
+
end
|
11
|
+
|
12
|
+
def deep_merge(second)
|
13
|
+
dup.deep_merge! second
|
10
14
|
end
|
11
15
|
end
|
12
16
|
end
|
data/meld.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: meld
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Les Aker
|
@@ -95,7 +95,7 @@ files:
|
|
95
95
|
- README.md
|
96
96
|
- Rakefile
|
97
97
|
- lib/meld.rb
|
98
|
-
- lib/meld/
|
98
|
+
- lib/meld/hash/deep_merge.rb
|
99
99
|
- meld.gemspec
|
100
100
|
- spec/meld_spec.rb
|
101
101
|
- spec/spec_helper.rb
|