deep_unrest 0.1.22 → 0.1.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/deep_unrest/version.rb +1 -1
- data/lib/deep_unrest.rb +5 -5
- 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: a6f9f64c69d2c7dd0d20bf22ed54cc65a93ae23e
|
4
|
+
data.tar.gz: 21e86160034752201ab7f58fefe798769107c67b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 197266467e40e207025ac6ac148acbae32025f26dbca897857a0100381a45ee46756216b3ff7131d0f6e5f9c2445e585f721e5b852e22eac4c25f9c8550d0db3
|
7
|
+
data.tar.gz: 21fafc16124e69101652e6c2e957c4b51e506dfffec4a61b2abb43da48db7cd9a5e57539409840b0ff1a8bbd6fc947a587c2d82c060c118818536a6c82dccb64
|
data/lib/deep_unrest/version.rb
CHANGED
data/lib/deep_unrest.rb
CHANGED
@@ -342,15 +342,14 @@ module DeepUnrest
|
|
342
342
|
end
|
343
343
|
|
344
344
|
def self.combine_arrays(a, b)
|
345
|
-
# get list of
|
345
|
+
# get list of items duped by id
|
346
346
|
groups = (a + b).flatten.group_by { |item| item[:id] }
|
347
|
-
|
348
347
|
dupes = groups.select { |_, v| v.size > 1 }.values
|
349
348
|
|
350
|
-
#
|
349
|
+
# filter non-dupe
|
351
350
|
non_dupes = groups.select { |_, v| v.size == 1 }.values
|
352
351
|
|
353
|
-
#
|
352
|
+
# recrsively merge dupes
|
354
353
|
merged = dupes.map do |(a2, b2)|
|
355
354
|
a2.deep_merge(b2) do |_, a3, b3|
|
356
355
|
if a3.is_a? Array
|
@@ -361,6 +360,7 @@ module DeepUnrest
|
|
361
360
|
end
|
362
361
|
end
|
363
362
|
|
363
|
+
# add merged dupes to non-dupes
|
364
364
|
(non_dupes + merged).flatten
|
365
365
|
end
|
366
366
|
|
@@ -493,7 +493,7 @@ module DeepUnrest
|
|
493
493
|
'@@temp_ids'
|
494
494
|
)
|
495
495
|
|
496
|
-
temp_id_map[ctx]
|
496
|
+
temp_id_map[ctx] ||= {}
|
497
497
|
|
498
498
|
# reject new resources marked for destruction
|
499
499
|
viable_params = params.reject do |param|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deep_unrest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lynn Hurley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|