data_model 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/data_model/struct.rb +11 -4
- data/lib/data_model/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec442d524136b58a53447650cd644a801b6fd117c8329462745d8f3891409c72
|
4
|
+
data.tar.gz: 9de27ed2d8b6f079dcbd9def6fc7afe4b051a1ce307d9156bee0ddfdd473f811
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c87894d04c913e2c3e1e7af718553da465cdd5ea519c5c3b88d9fc3dcfd701852100a85b992a168041d772dcd726a0c691b47c8de5d916d329202a34e34f19cb
|
7
|
+
data.tar.gz: 65422078b7c9a5a9f0a11164e0722387d032a65a985bd7056d1d45157719797171a2b05482faa62b840006fe9fa1b42041b70495fec0c7840299407a5dd9153e
|
data/lib/data_model/struct.rb
CHANGED
@@ -96,14 +96,21 @@ module DataModel
|
|
96
96
|
send("#{k}=", v)
|
97
97
|
end
|
98
98
|
|
99
|
-
|
99
|
+
required_types = self.class.required_types
|
100
|
+
found = []
|
101
|
+
|
102
|
+
for req in required_types
|
100
103
|
for key in data.keys
|
101
104
|
if key.to_s == req.to_s
|
102
|
-
|
105
|
+
found << req
|
106
|
+
break
|
103
107
|
end
|
104
108
|
end
|
105
|
-
|
106
|
-
|
109
|
+
end
|
110
|
+
|
111
|
+
found = required_types - found
|
112
|
+
if !found.empty?
|
113
|
+
raise "Missing required fields: #{found.join(', ')}"
|
107
114
|
end
|
108
115
|
end
|
109
116
|
|
data/lib/data_model/version.rb
CHANGED