lutaml-model 0.5.1 → 0.5.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
  SHA256:
3
- metadata.gz: 9643744c6317f6cbfa5e270954d5089cdce64961f5b0c8cd3ddffb228b2cbf84
4
- data.tar.gz: b10af4981f13f897b4df81624539b6ae64748548e92af37ce0632e2279b96f6b
3
+ metadata.gz: d57b531de09099b0f55b1891c2b0dfec1a04fa75229a40c5c6b974f3be92fcda
4
+ data.tar.gz: a893710f75fde8b5465360b95e6e772ba35711311a719ac35704a9a8ea7788ca
5
5
  SHA512:
6
- metadata.gz: 66cf686d10c146dc8d7f7a92c471a6da047e209f1fd37b748c1304f130176cd2473b69275b97072db9b8d08c93e4a480c028f1aa58980be5bc90091734b38a74
7
- data.tar.gz: f6029050d1da6ce304eadea3902312b8c8d58311caf65cb2c1e7d43fd10092523ae2084a301d72cc19afaedc2f9d1fcd2291ef13a00caad4a673897fa7b60259
6
+ metadata.gz: b9ef9798066d2ec69567a2cfb9277d0058b933b640df9c6c240c1010a626560c27cdd722d10a474deddf70560f902bf58d41e35d1e2d1a8aa0fe83a9451afb2a
7
+ data.tar.gz: 2c2bd13597f84afecd1aaf6fa4686db48048e371b014c55cb8c5993668eec38781e8b02ccd85a8ae5b68da8b3ea68056db87be7830128d35735c69f098711ff0
@@ -216,7 +216,9 @@ module Lutaml
216
216
  serialize(v, format, options)
217
217
  end
218
218
  elsif type <= Serialize
219
- type.public_send(:"as_#{format}", value, options)
219
+ if Utils.present?(value)
220
+ type.public_send(:"as_#{format}", value, options)
221
+ end
220
222
  else
221
223
  # Convert to Value instance if not already
222
224
  value = type.new(value) unless value.is_a?(Type::Value)
@@ -367,7 +367,16 @@ module Lutaml
367
367
  map_value = {}
368
368
  child_mappings.each do |attr_name, path|
369
369
  attr_value = child_obj.send(attr_name)
370
- attr_value = attr_value.to_yaml_hash if attr_value.is_a?(Lutaml::Model::Serialize)
370
+
371
+ attr_value = if attr_value.is_a?(Lutaml::Model::Serialize)
372
+ attr_value.to_yaml_hash
373
+ elsif attr_value.is_a?(Array) && attr_value.first.is_a?(Lutaml::Model::Serialize)
374
+ attr_value.map(&:to_yaml_hash)
375
+ else
376
+ attr_value
377
+ end
378
+
379
+ next if Utils.blank?(attr_value)
371
380
 
372
381
  if path == :key
373
382
  map_key = attr_value
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Lutaml
4
4
  module Model
5
- VERSION = "0.5.1"
5
+ VERSION = "0.5.2"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lutaml-model
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-01-09 00:00:00.000000000 Z
11
+ date: 2025-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -195,7 +195,7 @@ licenses:
195
195
  - BSD-2-Clause
196
196
  metadata:
197
197
  rubygems_mfa_required: 'true'
198
- post_install_message:
198
+ post_install_message:
199
199
  rdoc_options: []
200
200
  require_paths:
201
201
  - lib
@@ -211,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
211
211
  version: '0'
212
212
  requirements: []
213
213
  rubygems_version: 3.3.27
214
- signing_key:
214
+ signing_key:
215
215
  specification_version: 4
216
216
  summary: LutaML creating data models in Ruby
217
217
  test_files: []