clone_kit 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/clone_kit/cloners/mongoid_ruleset_cloner.rb +5 -1
- data/lib/clone_kit/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: 0b0aec7c705b57c2f5f5edc6b66569c9932b4364
|
4
|
+
data.tar.gz: 239c4c973df017ed083b8ac80d204328d5c0fd28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ca9701c9985621966beea58a720fae62622bd67774909c544d45255150212a2042dcbe9a545d4c3ddfeec329f37528741596e9cc794980b09875e027b7d9a91
|
7
|
+
data.tar.gz: 3ad4157dcc181fb178c16a4ee7c475ee12925d183a636bcae67971fbc3242817b351ad51e6b2a85a714ce5a9fb526907a6ef455f68db8e683b3ccc84700b00db
|
@@ -56,7 +56,7 @@ module CloneKit
|
|
56
56
|
item
|
57
57
|
end
|
58
58
|
|
59
|
-
return
|
59
|
+
return empty_embedded(metadata) if first_item.nil?
|
60
60
|
|
61
61
|
cloner = MongoidRulesetCloner.new(polymorphic_class(metadata.class_name, first_item))
|
62
62
|
embedded_cloner = CloneKit::Decorators::EmbeddedClonerDecorator.new(cloner, records: Array.wrap(item))
|
@@ -70,6 +70,10 @@ module CloneKit
|
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
73
|
+
def empty_embedded(metadata)
|
74
|
+
metadata.macro == :embeds_many ? [] : nil
|
75
|
+
end
|
76
|
+
|
73
77
|
def apply_rules_and_save(mapping, attributes)
|
74
78
|
new_id = BSON::ObjectId.new
|
75
79
|
old_id = attributes["_id"]
|
data/lib/clone_kit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clone_kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Croft
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|