lutaml-model 0.8.180 → 0.8.181

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e923a0e0792f0329e8bd5f4008d17baa30e80f4622f772d1b877c0ec13952c8b
4
- data.tar.gz: a59f92e90c98a6d0f1e77016616486be237c61db69410f1e412d1f91864d6345
3
+ metadata.gz: 461625987c7637612b57671b30897876e703d33fc0baa9354bcc59b8026666f7
4
+ data.tar.gz: 72ea3b59453e91f1272f86cf3c381684b736fa39fde338187dc5259239eeba80
5
5
  SHA512:
6
- metadata.gz: 86d5ec47de95898724f2517e9d206a7e027baa85178b0312de4f1f3aa4fc477d4ac4c77948c1a36c91187c3597b5d22a00c789c3adb23f0500f11ddc5cf2ae16
7
- data.tar.gz: 28abd3d0802117bfe05b9c5f825f825fc962c2aaa091b9eccfc2003bdcf60f011a629227d8a580743f7efb3400fcddebbf6e65c0a8d90ce897173e06e4ed0b94
6
+ metadata.gz: 4b719debdf1a00a74b1cd48ad26d69b3688de6873d8bdace9cd4d9a2b79a3041f6a39dcdec56672b259dfd5af11e324d764e678515a543cec2110343a1716b2d
7
+ data.tar.gz: 9b05b26ab2260074cd58582f5709b07b56189fcb8dce0155927cfe2e824ee73819ca56500fa03b273137b774a5b230afe4f36842eba0506c7428d41853f0782e
@@ -1,30 +1,30 @@
1
1
  {
2
2
  "complex1-46KB": {
3
- "avg_time": 0.038987152000004244,
4
- "min_time": 0.03892064699999764,
5
- "max_time": 0.0390598830000215,
6
- "allocations": 51960,
7
- "ips": 25.649475499002623
3
+ "avg_time": 0.035969980333324734,
4
+ "min_time": 0.03559261399999514,
5
+ "max_time": 0.036185082999992346,
6
+ "allocations": 50994,
7
+ "ips": 27.800960432373113
8
8
  },
9
9
  "complex4-50KB": {
10
- "avg_time": 0.054956423999991934,
11
- "min_time": 0.054518438000002334,
12
- "max_time": 0.055492561999983536,
13
- "allocations": 73271,
14
- "ips": 18.1962348933065
10
+ "avg_time": 0.04991650399999988,
11
+ "min_time": 0.04966256299999827,
12
+ "max_time": 0.050061231000000816,
13
+ "allocations": 71837,
14
+ "ips": 20.03345426594784
15
15
  },
16
16
  "size1000-245KB": {
17
- "avg_time": 0.30703477966667,
18
- "min_time": 0.3045259649999821,
19
- "max_time": 0.30771317600002135,
20
- "allocations": 414471,
21
- "ips": 3.2569600130826957
17
+ "avg_time": 0.28591416999999336,
18
+ "min_time": 0.2818747909999786,
19
+ "max_time": 0.2920046950000028,
20
+ "allocations": 406438,
21
+ "ips": 3.4975531293185758
22
22
  },
23
23
  "complex3-567KB": {
24
- "avg_time": 0.42949195166667664,
25
- "min_time": 0.4193377539999972,
26
- "max_time": 0.433647494000013,
27
- "allocations": 594058,
28
- "ips": 2.3283323380552834
24
+ "avg_time": 0.40071153599999815,
25
+ "min_time": 0.3966769870000064,
26
+ "max_time": 0.4045028329999809,
27
+ "allocations": 584888,
28
+ "ips": 2.49556079663253
29
29
  }
30
30
  }
@@ -1,23 +1,23 @@
1
1
  {
2
2
  "metrology-4KB": {
3
- "avg_time": 0.014322055000017523,
4
- "min_time": 0.01403489000006175,
5
- "max_time": 0.014681618999929924,
3
+ "avg_time": 0.008145603666662282,
4
+ "min_time": 0.007795773999987432,
5
+ "max_time": 0.008779492999906324,
6
6
  "allocations": 7544,
7
- "ips": 69.82238233261752
7
+ "ips": 122.76560963710097
8
8
  },
9
9
  "bmj-49KB": {
10
- "avg_time": 0.135603055000009,
11
- "min_time": 0.13427724500002114,
12
- "max_time": 0.136363015000029,
10
+ "avg_time": 0.0723875503333223,
11
+ "min_time": 0.07129628399991361,
12
+ "max_time": 0.07395147099998667,
13
13
  "allocations": 72378,
14
- "ips": 7.374465125434923
14
+ "ips": 13.814530197462258
15
15
  },
16
16
  "pnas-152KB": {
17
- "avg_time": 0.6455222233333492,
18
- "min_time": 0.6338481379999621,
19
- "max_time": 0.6546388550000302,
17
+ "avg_time": 0.34388590966667226,
18
+ "min_time": 0.3415666549999514,
19
+ "max_time": 0.34598907000008694,
20
20
  "allocations": 259437,
21
- "ips": 1.5491333432894032
21
+ "ips": 2.9079411859860658
22
22
  }
23
23
  }
@@ -1,30 +1,30 @@
1
1
  {
2
2
  "feature-doc-23KB": {
3
- "avg_time": 0.04434376266667073,
4
- "min_time": 0.04373320800002034,
5
- "max_time": 0.04516191199999753,
6
- "allocations": 32998,
7
- "ips": 22.55108587687827
3
+ "avg_time": 0.05333307866665867,
4
+ "min_time": 0.05320582799998874,
5
+ "max_time": 0.05343820699999924,
6
+ "allocations": 33278,
7
+ "ips": 18.750089531680324
8
8
  },
9
9
  "tbx-nisosts-101KB": {
10
- "avg_time": 0.12491149966665678,
11
- "min_time": 0.12318977799998265,
12
- "max_time": 0.12502275199997825,
13
- "allocations": 134786,
14
- "ips": 8.005668034317377
10
+ "avg_time": 0.1555278476666615,
11
+ "min_time": 0.15451645799998914,
12
+ "max_time": 0.15693985299998303,
13
+ "allocations": 134268,
14
+ "ips": 6.429716703488832
15
15
  },
16
16
  "iso-13849-1MB": {
17
- "avg_time": 4.2393353286666695,
18
- "min_time": 4.14070454900002,
19
- "max_time": 4.346694972999984,
20
- "allocations": 1733464,
21
- "ips": 0.23588603459554922
17
+ "avg_time": 5.377177922666665,
18
+ "min_time": 5.361418570000012,
19
+ "max_time": 5.4017619889999935,
20
+ "allocations": 1735227,
21
+ "ips": 0.1859711570607798
22
22
  },
23
23
  "din-iso-1.1MB": {
24
- "avg_time": 0.553708032666672,
25
- "min_time": 0.5457309070000065,
26
- "max_time": 0.5579077530000234,
27
- "allocations": 890629,
28
- "ips": 1.8060059471847907
24
+ "avg_time": 0.5874012496666694,
25
+ "min_time": 0.5822755989999848,
26
+ "max_time": 0.5889298150000002,
27
+ "allocations": 877606,
28
+ "ips": 1.7024138109468896
29
29
  }
30
30
  }
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "800-expressions": {
3
- "avg_time": 0.20656500466666708,
4
- "min_time": 0.20511490399999843,
5
- "max_time": 0.20850260099999218,
6
- "allocations": 134002,
7
- "ips": 4.84109107258364
3
+ "avg_time": 0.544940995666669,
4
+ "min_time": 0.5414146770000059,
5
+ "max_time": 0.5454735960000079,
6
+ "allocations": 138102,
7
+ "ips": 1.835061057897877
8
8
  }
9
9
  }
@@ -1,30 +1,30 @@
1
1
  {
2
2
  "ea251": {
3
- "avg_time": 0.19469534333334573,
4
- "min_time": 0.19171984600001224,
5
- "max_time": 0.19764657100000704,
6
- "allocations": 183576,
7
- "ips": 5.136229674933004
3
+ "avg_time": 0.17969961900000916,
4
+ "min_time": 0.17811001200001897,
5
+ "max_time": 0.18114700399999606,
6
+ "allocations": 182292,
7
+ "ips": 5.564842071256417
8
8
  },
9
9
  "medium": {
10
- "avg_time": 0.48711105866667026,
11
- "min_time": 0.4837137160000111,
12
- "max_time": 0.4910841039999809,
13
- "allocations": 475118,
14
- "ips": 2.052919929055233
10
+ "avg_time": 0.44894484466666046,
11
+ "min_time": 0.43719278499997927,
12
+ "max_time": 0.45557199699999273,
13
+ "allocations": 471852,
14
+ "ips": 2.2274451124224304
15
15
  },
16
16
  "citygml": {
17
- "avg_time": 0.5485396233333404,
18
- "min_time": 0.5461445280000135,
19
- "max_time": 0.5517981899999995,
20
- "allocations": 587519,
21
- "ips": 1.8230223624015454
17
+ "avg_time": 0.506995725666665,
18
+ "min_time": 0.503759285000001,
19
+ "max_time": 0.5088972249999983,
20
+ "allocations": 583260,
21
+ "ips": 1.972403216388201
22
22
  },
23
23
  "large": {
24
- "avg_time": 4.595026431666658,
25
- "min_time": 4.556988206999989,
26
- "max_time": 4.632750786000003,
27
- "allocations": 4538888,
28
- "ips": 0.2176266045192891
24
+ "avg_time": 4.185453844333334,
25
+ "min_time": 4.1155831300000045,
26
+ "max_time": 4.230669285999994,
27
+ "allocations": 4506877,
28
+ "ips": 0.23892271595681203
29
29
  }
30
30
  }
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Lutaml
4
4
  module Model
5
- VERSION = "0.8.180"
5
+ VERSION = "0.8.181"
6
6
  end
7
7
  end
@@ -396,6 +396,13 @@ register_id, register)
396
396
  content_index = index + 1
397
397
  parent.add_child(value[content_index].to_s) if value[content_index]
398
398
  end
399
+
400
+ # A trailing run of consecutive text entries has no element
401
+ # slots to interleave into; without this append every entry
402
+ # past children.size + 1 was silently dropped (#1164).
403
+ value[(existing_children.size + 1)..]&.each do |entry|
404
+ parent.add_child(entry.to_s) if entry
405
+ end
399
406
  end
400
407
  end
401
408
  end
@@ -359,6 +359,30 @@ module MixedContentSpec
359
359
  end
360
360
  end
361
361
 
362
+ module MixedContentSpec
363
+ class ConsecutiveText < Lutaml::Model::Serializable
364
+ attribute :text, :string, collection: true
365
+
366
+ xml do
367
+ element "p"
368
+ mixed_content
369
+ map_content to: :text
370
+ end
371
+ end
372
+
373
+ class ConsecutiveTextWithElement < Lutaml::Model::Serializable
374
+ attribute :text, :string, collection: true
375
+ attribute :italic, :string, collection: true
376
+
377
+ xml do
378
+ element "p"
379
+ mixed_content
380
+ map_content to: :text
381
+ map_element "i", to: :italic
382
+ end
383
+ end
384
+ end
385
+
362
386
  RSpec.describe "MixedContent" do
363
387
  shared_examples "mixed content behavior" do |adapter_class|
364
388
  around do |example|
@@ -647,6 +671,40 @@ RSpec.describe "MixedContent" do
647
671
  end
648
672
  end
649
673
 
674
+ context "when a built model holds a run of consecutive map_content entries" do
675
+ # lutaml-model#1164: the interleaving slots are element-shaped;
676
+ # a trailing run of text entries had no slots and was silently
677
+ # dropped.
678
+ it "serializes every consecutive text entry" do
679
+ model = MixedContentSpec::ConsecutiveText.new
680
+ model.text("First")
681
+ model.text("Second")
682
+
683
+ expect(model.to_xml).to include("First")
684
+ expect(model.to_xml).to include("Second")
685
+ expect(model.to_xml).to eq("<p>FirstSecond</p>")
686
+ end
687
+
688
+ it "appends the trailing run after the last mapped element" do
689
+ model = MixedContentSpec::ConsecutiveTextWithElement.new
690
+ model.text("A")
691
+ model.italic("i")
692
+ model.text("B")
693
+ model.text("C")
694
+
695
+ expect(model.to_xml).to eq("<p>A<i>i</i>BC</p>")
696
+ end
697
+
698
+ it "keeps the interleaved shape when entries alternate with elements" do
699
+ model = MixedContentSpec::ConsecutiveTextWithElement.new
700
+ model.text("AB")
701
+ model.italic("i")
702
+ model.text("CD")
703
+
704
+ expect(model.to_xml).to eq("<p>AB<i>i</i>CD</p>")
705
+ end
706
+ end
707
+
650
708
  context "when mixed: true is used with map_element" do
651
709
  it "raises an error" do
652
710
  expect do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lutaml-model
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.180
4
+ version: 0.8.181
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.