activeentity 0.0.1.beta6 → 0.0.1.beta7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c154e7165f6bbe5e99ec3996ee46ac4062e09086c8d90e0be769106f16791df4
4
- data.tar.gz: 1473e2ea9042d0e8405f97b53d2659c6983c95a5ac462ea9bde7858128cd3f65
3
+ metadata.gz: 2e1c2c1130f1a4dc9deb8425b542a4db50aeea8e50d365d5b3d42ef6bf11b8d0
4
+ data.tar.gz: 5e8d4e28096dfcc3b0e0589e2c05e56866a1ad7a45f328728cc9ecde81478a37
5
5
  SHA512:
6
- metadata.gz: a2daadb48b891c1d71063a3242b9d586a72fd9f20060ae7305e53a2561ac18dc129f523d72236cfd38a37385ee9cb23331fc5029670b833f4322380436fdd368
7
- data.tar.gz: 6f9d0d4c1729a206500141afc77a2717652fea6548d0e9b23c68b3ef96184eb57ae25bfd654f0d509d591d5faa4dc00fb4616eda5e9da86c91932894c334a946
6
+ metadata.gz: bd64ddbf122a6f74b5c4ce60ed0e3dc37356133149ebdef59fc9931f42a4e94361acaa4bc6349ac28f2f3f66d55e0d297580d562559b4c92909521abd66db79a
7
+ data.tar.gz: 2ec470ad55e02d72c9d81a4e914b092cf73377347891d761f172cc28c1605bdf8263f984a4800cdeeb6282c86094301705805f88ec0482523e879a5406ef05b7
@@ -124,9 +124,20 @@ module ActiveEntity
124
124
  # Replace this collection with +other_array+. This will perform a diff
125
125
  # and delete/add only records that have changed.
126
126
  def replace(other_array)
127
- other_array.each { |val| raise_on_type_mismatch!(val) }
127
+ records = other_array.map do |val|
128
+ if val.is_a? reflection.klass
129
+ val
130
+ elsif val.nil?
131
+ next
132
+ elsif val.respond_to?(:to_h)
133
+ build_record(val.to_h)
134
+ end
135
+ rescue => ex
136
+ raise_on_type_mismatch!(val)
137
+ raise ex
138
+ end
128
139
 
129
- target.replace other_array
140
+ target.replace records
130
141
  end
131
142
 
132
143
  def include?(record)
@@ -10,7 +10,7 @@ module ActiveEntity
10
10
  MAJOR = 0
11
11
  MINOR = 0
12
12
  TINY = 1
13
- PRE = "beta6"
13
+ PRE = "beta7"
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeentity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.beta6
4
+ version: 0.0.1.beta7
5
5
  platform: ruby
6
6
  authors:
7
7
  - jasl