schema-model 0.6.8 → 0.6.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/schema/associations/has_many.rb +5 -0
- data/lib/schema/model.rb +5 -1
- data/schema-model.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 991632c4e13a6020fa51c75785cbf9cf3549a2628e8482fd55f6118ad5a22d90
|
4
|
+
data.tar.gz: 82a9b70b1e99ef72884528f7413b63b18224c1e613e0f561e74c1207dd8cd21b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c96de3ffd4bcbac6669dcce6f125a042cd36d0f079ca586280ab89d94bca54becef85e822246fedd08c48bae9fb5d4b882d4858cbc275dbd0910d7c9b23d8c4b
|
7
|
+
data.tar.gz: 235d1e221a1f7aeeef723a143c5b0f3abc49a7f526622a449120f9c4ad020bba928bda92933416d1db61388fc06a6c8d25571de4bc4c20e8cdc436839acb4ff5
|
@@ -27,6 +27,11 @@ module Schema
|
|
27
27
|
def #{options[:setter]}(v)
|
28
28
|
#{options[:instance_variable]} = #{name}_schema_creator.create_schemas(self, v)
|
29
29
|
end
|
30
|
+
|
31
|
+
def append_to_#{options[:getter]}(v)
|
32
|
+
#{options[:instance_variable]} ||= []
|
33
|
+
#{options[:instance_variable]} << #{name}_schema_creator.create_schema(self, v)
|
34
|
+
end
|
30
35
|
STR
|
31
36
|
)
|
32
37
|
|
data/lib/schema/model.rb
CHANGED
@@ -129,7 +129,11 @@ STR
|
|
129
129
|
next if opts[:select_filter] && !opts[:select_filter].call(field_name, value, field_options)
|
130
130
|
next if opts[:reject_filter] && opts[:reject_filter].call(field_name, value, field_options)
|
131
131
|
|
132
|
-
|
132
|
+
if value.is_a?(Array)
|
133
|
+
memo[field_name] = value.map { |e| e.as_json(opts) }
|
134
|
+
else
|
135
|
+
memo[field_name] = value.respond_to?(:as_json) ? value.as_json(opts) : value
|
136
|
+
end
|
133
137
|
end
|
134
138
|
end
|
135
139
|
end
|
data/schema-model.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: schema-model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Doug Youch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: inheritance-helper
|