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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5d996d080555c7553965069f80fc44c902ef72831635bdab8ae6515883e00334
4
- data.tar.gz: da062d6c1a477c63382116961a7a8634cd13444a8a1797c38067d34d44d1faf0
3
+ metadata.gz: 991632c4e13a6020fa51c75785cbf9cf3549a2628e8482fd55f6118ad5a22d90
4
+ data.tar.gz: 82a9b70b1e99ef72884528f7413b63b18224c1e613e0f561e74c1207dd8cd21b
5
5
  SHA512:
6
- metadata.gz: b29a0e7d32895ffe1c941860cb9f1af7efcfa4bc0a82a8ea86956d5c322f5fb1255301ee1702555546cc5d662c4981c2145167c9f453bdb15ce21fd34002ce1d
7
- data.tar.gz: 4bac466d153605319ae50dc62a028e42b07ffe93ae589f4ed99dcedd54ade7a899f51acfbef45b35f395f77f8f2450cbcbdf2f57caf6d7afcfa1f75b66f2f22b
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
- memo[field_name] = value.respond_to?(:as_json) ? value.as_json(opts) : value
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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'schema-model'
5
- s.version = '0.6.8'
5
+ s.version = '0.6.9'
6
6
  s.licenses = ['MIT']
7
7
  s.summary = 'Schema Model'
8
8
  s.description = 'Easy way to create models from payloads'
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.8
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-05-26 00:00:00.000000000 Z
11
+ date: 2022-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: inheritance-helper