soar_xt 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/soar_xt/soar_extend_hash.rb +9 -32
- data/lib/soar_xt/version.rb +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: 25af9d72347cdf3329b070c8ea7b3abc712b4d66
|
4
|
+
data.tar.gz: 08773559ff64e489767df343cb73c09185b9efac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8ab982055a4ce8695a92574b3a0d8023ce38961f4cb18f9611f983187053e7b28eabede9b1e0b54be93dc4423d673bca3293f5d1ece356cec6e3f8e87d10ace
|
7
|
+
data.tar.gz: d35a50ec02233eb8663c58487bc77e0372e27a569ae5bccf2beeffe83664d34cae70178b9e551febfec2cbfe79d22f276824998de3a04dd26e3845dcc0aed127
|
@@ -1,36 +1,13 @@
|
|
1
1
|
class ::Hash
|
2
|
-
def self.deep_merge(
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
end
|
11
|
-
first.each do |first_key, first_value|
|
12
|
-
second.each do |second_key, second_value|
|
13
|
-
if (first_key == second_key)
|
14
|
-
if first_value.is_a?(Hash) and (second_value.is_a?(Hash))
|
15
|
-
result[first_key] = Hash::deep_merge(first_value, second_value)
|
16
|
-
elsif first_value.is_a?(Array) and (second_value.is_a?(Array))
|
17
|
-
result[first_key] = first_value + second_value
|
18
|
-
else
|
19
|
-
puts "tbd"
|
20
|
-
# result[first_key] = second_value
|
21
|
-
end
|
22
|
-
end
|
2
|
+
def self.deep_merge(a, b)
|
3
|
+
a.dup.merge(b) do |_,x,y|
|
4
|
+
if (x.is_a?(Hash) && y.is_a?(Hash))
|
5
|
+
deep_merge(x,y)
|
6
|
+
elsif x.is_a?(Array) && (y.is_a?(Array))
|
7
|
+
x + y
|
8
|
+
else
|
9
|
+
y
|
23
10
|
end
|
24
|
-
end
|
25
|
-
result
|
11
|
+
end
|
26
12
|
end
|
27
|
-
|
28
|
-
# def self.value_has_hash?(value)
|
29
|
-
# return nil if not value.is_a?(Hash)
|
30
|
-
# keys = []
|
31
|
-
# value.each do |k, v|
|
32
|
-
# keys << k if v.is_a?(Hash)
|
33
|
-
# end
|
34
|
-
# keys
|
35
|
-
# end
|
36
13
|
end
|
data/lib/soar_xt/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soar_xt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ernst van Graan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|