superseeder 0.9.6 → 0.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/superseeder/formats/roo.rb +18 -3
- data/lib/superseeder/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ade07004cde17170806d4cb3bff23d87a17da13
|
4
|
+
data.tar.gz: 9c810fdd2b4b7e16d630d1b8e6b5f032c02f96b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f58e4f861140b8f6ba728afa18fcbbd797a00d69ff586e188d14437d57e722118d98e9a174819db6e2eec5b5d1f80c5d15dfefe7b5b3540ae216e55db14e41f2
|
7
|
+
data.tar.gz: 2dace6f39aab70880d6640a5b7ee683d1b7ec8ae428cc3c63a67db614f9561cf6158cdd5db79518b70a283cb321bfecf42ddd155437883dd7455d8b0cb422a16
|
@@ -28,9 +28,24 @@ module Superseeder
|
|
28
28
|
yield row, opts
|
29
29
|
else
|
30
30
|
instance = row['_type'].blank? ? self : row['_type'].constantize
|
31
|
-
|
32
|
-
|
33
|
-
|
31
|
+
update_by = opts[:update_by]
|
32
|
+
instance = if update_by
|
33
|
+
if update_by.kind_of? Proc
|
34
|
+
i = update_by.call(instance, row)
|
35
|
+
i || instance.new
|
36
|
+
end
|
37
|
+
if update_by.kind_of? Array
|
38
|
+
i = self.all
|
39
|
+
update_by.each do |u|
|
40
|
+
i = i.where u => row[u]
|
41
|
+
end
|
42
|
+
i = i.entries
|
43
|
+
raise ArgumentError.new ":update_by => #{update_by} yielded more than one record!" if i.length > 1
|
44
|
+
i.first || instance.new
|
45
|
+
else
|
46
|
+
i = instance.find_by update_by => row[update_by]
|
47
|
+
i || instance.new
|
48
|
+
end
|
34
49
|
else
|
35
50
|
instance.new
|
36
51
|
end
|
data/lib/superseeder/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: superseeder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Olivier Milla
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -226,3 +226,4 @@ test_files:
|
|
226
226
|
- test/dummy/config/locales/en.yml
|
227
227
|
- test/dummy/config/application.rb
|
228
228
|
- test/test_helper.rb
|
229
|
+
has_rdoc:
|