babl-json 0.5.4 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/babl/nodes/concat.rb +2 -2
- data/lib/babl/nodes/each.rb +1 -1
- data/lib/babl/nodes/fixed_array.rb +2 -2
- data/lib/babl/nodes/merge.rb +2 -2
- data/lib/babl/nodes/nav.rb +1 -1
- data/lib/babl/nodes/object.rb +2 -3
- data/lib/babl/nodes/switch.rb +2 -4
- data/lib/babl/nodes/with.rb +3 -6
- data/lib/babl/utils/hash.rb +10 -4
- data/lib/babl/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: 06e7d0d6838bd28a3c50434afec9a7ef3673f659
|
4
|
+
data.tar.gz: 8e4d913e0e5b97e9280a2535543a73c069e2cf84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb6f0a919e68efd724dffbe3ffccdda0b48a780dc73e41b50c963868d7c1ce5ca92d3935f1566eeeff1e02e9f1d8a3ec8627aba46cc052dbc69052b50de5596c
|
7
|
+
data.tar.gz: 263c993251039ad9266380382ad0b41206eed7b554cb917aae4b70b5d693a8246ac249201cc7b8df51567f6ecade0775d5981cf92460430c794f6cad2d87736d
|
data/lib/babl/nodes/concat.rb
CHANGED
@@ -7,11 +7,11 @@ module Babl
|
|
7
7
|
module Nodes
|
8
8
|
class Concat < Utils::Value.new(:nodes)
|
9
9
|
def dependencies
|
10
|
-
|
10
|
+
Babl::Utils::Hash.deep_merge(*nodes.map(&:dependencies))
|
11
11
|
end
|
12
12
|
|
13
13
|
def pinned_dependencies
|
14
|
-
|
14
|
+
Babl::Utils::Hash.deep_merge(*nodes.map(&:pinned_dependencies))
|
15
15
|
end
|
16
16
|
|
17
17
|
def schema
|
data/lib/babl/nodes/each.rb
CHANGED
@@ -8,7 +8,7 @@ module Babl
|
|
8
8
|
class Each < Utils::Value.new(:node)
|
9
9
|
def dependencies
|
10
10
|
node_deps = node.dependencies
|
11
|
-
child_deps =
|
11
|
+
child_deps = node_deps.reject { |key, _| key == Parent::PARENT_MARKER }
|
12
12
|
|
13
13
|
Babl::Utils::Hash.deep_merge(
|
14
14
|
node_deps[Parent::PARENT_MARKER] || Utils::Hash::EMPTY,
|
@@ -13,11 +13,11 @@ module Babl
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def dependencies
|
16
|
-
|
16
|
+
Babl::Utils::Hash.deep_merge(*nodes.map(&:dependencies))
|
17
17
|
end
|
18
18
|
|
19
19
|
def pinned_dependencies
|
20
|
-
|
20
|
+
Babl::Utils::Hash.deep_merge(*nodes.map(&:pinned_dependencies))
|
21
21
|
end
|
22
22
|
|
23
23
|
def render(frame)
|
data/lib/babl/nodes/merge.rb
CHANGED
@@ -8,11 +8,11 @@ module Babl
|
|
8
8
|
module Nodes
|
9
9
|
class Merge < Utils::Value.new(:nodes)
|
10
10
|
def dependencies
|
11
|
-
|
11
|
+
Babl::Utils::Hash.deep_merge(*nodes.map(&:dependencies))
|
12
12
|
end
|
13
13
|
|
14
14
|
def pinned_dependencies
|
15
|
-
|
15
|
+
Babl::Utils::Hash.deep_merge(*nodes.map(&:pinned_dependencies))
|
16
16
|
end
|
17
17
|
|
18
18
|
def schema
|
data/lib/babl/nodes/nav.rb
CHANGED
@@ -8,7 +8,7 @@ module Babl
|
|
8
8
|
class Nav < Utils::Value.new(:property, :node)
|
9
9
|
def dependencies
|
10
10
|
node_deps = node.dependencies
|
11
|
-
child_deps =
|
11
|
+
child_deps = node_deps.reject { |key, _| key == Parent::PARENT_MARKER }
|
12
12
|
|
13
13
|
Babl::Utils::Hash.deep_merge(
|
14
14
|
node_deps[Parent::PARENT_MARKER] || Utils::Hash::EMPTY,
|
data/lib/babl/nodes/object.rb
CHANGED
@@ -9,12 +9,11 @@ module Babl
|
|
9
9
|
EMPTY = new(Utils::Hash::EMPTY)
|
10
10
|
|
11
11
|
def dependencies
|
12
|
-
nodes.values.map(&:dependencies)
|
12
|
+
Babl::Utils::Hash.deep_merge(*nodes.values.map(&:dependencies))
|
13
13
|
end
|
14
14
|
|
15
15
|
def pinned_dependencies
|
16
|
-
nodes.values.map(&:pinned_dependencies)
|
17
|
-
.reduce(Utils::Hash::EMPTY) { |a, b| Babl::Utils::Hash.deep_merge(a, b) }
|
16
|
+
Babl::Utils::Hash.deep_merge(*nodes.values.map(&:pinned_dependencies))
|
18
17
|
end
|
19
18
|
|
20
19
|
def schema
|
data/lib/babl/nodes/switch.rb
CHANGED
@@ -14,13 +14,11 @@ module Babl
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def dependencies
|
17
|
-
nodes.flatten(1).map(&:dependencies)
|
18
|
-
.reduce(Utils::Hash::EMPTY) { |a, b| Babl::Utils::Hash.deep_merge(a, b) }
|
17
|
+
Babl::Utils::Hash.deep_merge(*nodes.flatten(1).map(&:dependencies))
|
19
18
|
end
|
20
19
|
|
21
20
|
def pinned_dependencies
|
22
|
-
nodes.flatten(1).map(&:pinned_dependencies)
|
23
|
-
.reduce(Utils::Hash::EMPTY) { |a, b| Babl::Utils::Hash.deep_merge(a, b) }
|
21
|
+
Babl::Utils::Hash.deep_merge(*nodes.flatten(1).map(&:pinned_dependencies))
|
24
22
|
end
|
25
23
|
|
26
24
|
def schema
|
data/lib/babl/nodes/with.rb
CHANGED
@@ -11,16 +11,13 @@ module Babl
|
|
11
11
|
|
12
12
|
def dependencies
|
13
13
|
Babl::Utils::Hash.deep_merge(
|
14
|
-
|
15
|
-
|
16
|
-
Babl::Utils::Hash.deep_merge(a, b)
|
17
|
-
}
|
14
|
+
*nodes.map(&:dependencies),
|
15
|
+
node.dependencies[Parent::PARENT_MARKER] || Utils::Hash::EMPTY
|
18
16
|
)
|
19
17
|
end
|
20
18
|
|
21
19
|
def pinned_dependencies
|
22
|
-
(nodes + [node]).map(&:pinned_dependencies)
|
23
|
-
.reduce(Utils::Hash::EMPTY) { |a, b| Babl::Utils::Hash.deep_merge(a, b) }
|
20
|
+
Babl::Utils::Hash.deep_merge(*(nodes + [node]).map(&:pinned_dependencies))
|
24
21
|
end
|
25
22
|
|
26
23
|
def render(frame)
|
data/lib/babl/utils/hash.rb
CHANGED
@@ -4,10 +4,16 @@ module Babl
|
|
4
4
|
class Hash
|
5
5
|
EMPTY = {}.freeze
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
first.
|
7
|
+
def self.deep_merge(*hashes)
|
8
|
+
filtered_hashes = hashes.reject(&:empty?)
|
9
|
+
return EMPTY if filtered_hashes.empty?
|
10
|
+
return filtered_hashes.first if filtered_hashes.size == 1
|
11
|
+
filtered_hashes.reduce({}) { |out, hash| deep_merge_inplace(out, hash) }
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.deep_merge_inplace(target, source)
|
15
|
+
source.each { |k, v| target[k] = deep_merge_inplace(target[k] || {}, v) }
|
16
|
+
target
|
11
17
|
end
|
12
18
|
end
|
13
19
|
end
|
data/lib/babl/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: babl-json
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frederic Terrazzoni
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coveralls
|