activerecord-bixformer 0.4.12 → 0.4.13
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/activerecord-bixformer/model/base.rb +18 -5
- data/lib/activerecord-bixformer/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18a1d0fe7e88548ee68e8c40d795a239b931195c
|
4
|
+
data.tar.gz: fc576daa90e40135a7c5c5fc8c5f912f4e55a800
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5896a50008272eba1bbf62e5476a0321ab337110fa5fe9c388f9f20301d7c0c2e3c0c7a5cdfa4395c603074829ffa5594963f882f047fb65d83e20ac8151624b
|
7
|
+
data.tar.gz: 7d4afa28dd6db8883d4bd3e30840f5bb07efb5fe126f1e6be273a7d8e894dd400f39edb0f9b323ceb1a6f8d15536ef925cebbb2ae0022ba116625d1eb7eef247
|
@@ -87,17 +87,30 @@ module ActiveRecord
|
|
87
87
|
arr = []
|
88
88
|
hash = {}
|
89
89
|
|
90
|
+
symbolizer = -> (value) do
|
91
|
+
case value
|
92
|
+
when ::Hash
|
93
|
+
value.map { |k, v| [k.to_sym, symbolizer.call(v)]}.to_h
|
94
|
+
when ::Array
|
95
|
+
value.map { |v| symbolizer.call(v) }
|
96
|
+
when ::String
|
97
|
+
value.to_sym
|
98
|
+
else
|
99
|
+
value
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
90
103
|
@attributes.each do |attr|
|
91
104
|
attr_should_be_included = attr.should_be_included
|
92
105
|
|
93
106
|
next unless attr_should_be_included
|
94
107
|
|
95
108
|
if attr_should_be_included.is_a?(::Hash)
|
96
|
-
hash.merge!(attr_should_be_included)
|
109
|
+
hash.merge!(symbolizer.call(attr_should_be_included))
|
97
110
|
elsif attr_should_be_included.is_a?(::Array)
|
98
|
-
arr.push *attr_should_be_included
|
111
|
+
arr.push *symbolizer.call(attr_should_be_included)
|
99
112
|
else
|
100
|
-
arr.push attr_should_be_included
|
113
|
+
arr.push symbolizer.call(attr_should_be_included)
|
101
114
|
end
|
102
115
|
end
|
103
116
|
|
@@ -105,9 +118,9 @@ module ActiveRecord
|
|
105
118
|
assoc_should_be_included = assoc.should_be_included
|
106
119
|
|
107
120
|
if assoc_should_be_included.empty?
|
108
|
-
arr.push assoc.name
|
121
|
+
arr.push assoc.name.to_sym
|
109
122
|
else
|
110
|
-
hash[assoc.name] = assoc_should_be_included
|
123
|
+
hash[assoc.name.to_sym] = assoc_should_be_included
|
111
124
|
end
|
112
125
|
end
|
113
126
|
|