superseeder 0.9.8.1 → 0.9.8.2
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1cb740903ff215700321a61e67f30b1003ae6503
|
4
|
+
data.tar.gz: 12f91256303b6fe7ed55d1ff2633b42dd74a0018
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 152314ea7ad7a866c9fdab7009267ddd4814cc63e701a361ea7a533e13d92ef0186497a5ab06b3027ba1794b04ea2ad1d5eebada722518a3704034ac21b46d28
|
7
|
+
data.tar.gz: 256fd0f0eebf95b846d495d55b2162fab7ce8db531a6715d1ab3e1b75430027405b50d6c6a0766f56d50cc57d5650ce9fdd308bb94c72704c09a843415fe138f
|
@@ -11,7 +11,7 @@ module Superseeder
|
|
11
11
|
def each_field(row)
|
12
12
|
self.instance.attributes.each do |field, val|
|
13
13
|
next unless row.key? field
|
14
|
-
yield field, false #self.is_array_field?(options) TODO inquiry
|
14
|
+
yield field, false, false #self.is_array_field?(options) TODO inquiry
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
@@ -21,6 +21,10 @@ module Superseeder
|
|
21
21
|
options.type == Array
|
22
22
|
end
|
23
23
|
|
24
|
+
def is_hash_field?(options)
|
25
|
+
options.type == Hash
|
26
|
+
end
|
27
|
+
|
24
28
|
def is_array_relation?(reflection)
|
25
29
|
[::ActiveRecord::Reflection::HasManyReflection,
|
26
30
|
::ActiveRecord::Reflection::HasAndBelongsToManyReflection].any?{ |c| reflection.kind_of? c }
|
@@ -10,7 +10,7 @@ module Superseeder
|
|
10
10
|
|
11
11
|
def each_field(row)
|
12
12
|
self.instance.fields.select{ |f, o| row.key? o.options[:as] || f }.each do |field, options|
|
13
|
-
yield options.options[:as] || field, self.is_array_field?(options)
|
13
|
+
yield options.options[:as] || field, self.is_array_field?(options), self.is_hash_field?(options)
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
@@ -20,6 +20,10 @@ module Superseeder
|
|
20
20
|
options.type == Array
|
21
21
|
end
|
22
22
|
|
23
|
+
def is_hash_field?(options)
|
24
|
+
options.type == Hash
|
25
|
+
end
|
26
|
+
|
23
27
|
def is_array_relation?(options)
|
24
28
|
[::Mongoid::Relations::Referenced::Many,
|
25
29
|
::Mongoid::Relations::Embedded::Many,
|
@@ -74,9 +74,11 @@ module Superseeder
|
|
74
74
|
end
|
75
75
|
|
76
76
|
# Set fields
|
77
|
-
adapter.each_field(row) do |name, is_array|
|
77
|
+
adapter.each_field(row) do |name, is_array, is_hash|
|
78
78
|
val = if is_array
|
79
79
|
row[name].try(:split, many_sep)
|
80
|
+
elsif is_hash
|
81
|
+
eval row[name] if row[name]
|
80
82
|
else
|
81
83
|
row[name]
|
82
84
|
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.8.
|
4
|
+
version: 0.9.8.2
|
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-
|
11
|
+
date: 2015-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|