lutaml-model 0.8.66 → 0.8.67
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 +4 -4
- data/lib/lutaml/model/attribute.rb +20 -8
- data/lib/lutaml/model/version.rb +1 -1
- data/lib/lutaml/xml/plan_hydrator.rb +23 -10
- 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: 52c9d5f90fb80dbbec116f4a6e8d65e92d8b5fe3181a9a4b7aa26349b64d8938
|
|
4
|
+
data.tar.gz: 657ef667d7d9192a6f6d6592168c8bf5c3a3f25aeff8fa4127d4438954ac7bf0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 14797b4e4855ac206622648c2ae5cf01b5115e9a243f461861d90e78903a80df356d35144b024801dd9556ed3d89fe526069157faf5bceb804088829be768be4
|
|
7
|
+
data.tar.gz: 179a58214dc093680917167055d3f3deec644303b310c91763d27c6aed18b19fc1e5668dea0c8a1a1e3542ef54b8d39712ade45a869ee0c072f1bb92ae10c18f
|
|
@@ -566,10 +566,15 @@ instance_object = nil)
|
|
|
566
566
|
end
|
|
567
567
|
|
|
568
568
|
def default_value(register, instance_object = nil)
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
569
|
+
# The kind is fixed at definition; the common case (no default
|
|
570
|
+
# at all) paid three option checks per absent attribute per
|
|
571
|
+
# instantiation before the memo.
|
|
572
|
+
case (@default_kind ||= _default_kind)
|
|
573
|
+
when :none
|
|
574
|
+
Lutaml::Model::UninitializedClass.instance
|
|
575
|
+
when :static
|
|
576
|
+
options[:default]
|
|
577
|
+
when :proc
|
|
573
578
|
if instance_object
|
|
574
579
|
::Lutaml::Model::Attribute.evaluating_default do
|
|
575
580
|
instance_object.instance_exec(&options[:default])
|
|
@@ -577,13 +582,20 @@ instance_object = nil)
|
|
|
577
582
|
else
|
|
578
583
|
options[:default].call
|
|
579
584
|
end
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
Lutaml::Model::UninitializedClass.instance
|
|
585
|
+
else # :delegate
|
|
586
|
+
type(register).attributes(register)[to].default(register,
|
|
587
|
+
instance_object)
|
|
584
588
|
end
|
|
585
589
|
end
|
|
586
590
|
|
|
591
|
+
def _default_kind
|
|
592
|
+
return :delegate if delegate
|
|
593
|
+
return :proc if options[:default].is_a?(Proc)
|
|
594
|
+
return :static if options.key?(:default)
|
|
595
|
+
|
|
596
|
+
:none
|
|
597
|
+
end
|
|
598
|
+
|
|
587
599
|
# Marks the dynamic extent in which a default proc runs against a
|
|
588
600
|
# model instance, so Serialize#method_missing can fall back to the
|
|
589
601
|
# model class for methods the instance does not define (0.7.x
|
data/lib/lutaml/model/version.rb
CHANGED
|
@@ -66,14 +66,14 @@ module Lutaml
|
|
|
66
66
|
def attributes_kwargs(plan, value, node = nil)
|
|
67
67
|
kwargs = {}
|
|
68
68
|
sole_claimants = sole_claimant_names(plan)
|
|
69
|
-
plan
|
|
70
|
-
v = value.attribute(
|
|
71
|
-
if v.nil? && node && sole_claimants.include?(
|
|
69
|
+
plan_attr_rows(plan).each do |rule, attr, name|
|
|
70
|
+
v = value.attribute(name)
|
|
71
|
+
if v.nil? && node && sole_claimants.include?(name)
|
|
72
72
|
# #754/#790 parity: a sole-claimant attribute rule binds
|
|
73
73
|
# any qualification (the interpretive matcher's lenient
|
|
74
74
|
# recovery). The walk captures exact (URI, local) matches
|
|
75
75
|
# only, so the qualified spelling is read off the node.
|
|
76
|
-
v = lenient_node_attribute(node,
|
|
76
|
+
v = lenient_node_attribute(node, name)
|
|
77
77
|
end
|
|
78
78
|
next if v.nil?
|
|
79
79
|
|
|
@@ -86,6 +86,15 @@ module Lutaml
|
|
|
86
86
|
kwargs
|
|
87
87
|
end
|
|
88
88
|
|
|
89
|
+
# Wire-name strings are plan-frozen; materializing them per
|
|
90
|
+
# hydration allocated two or three strings per attribute row
|
|
91
|
+
# per instance.
|
|
92
|
+
def plan_attr_rows(plan)
|
|
93
|
+
plan[:attr_row_names] ||= plan[:attr_rows].map do |rule, attr|
|
|
94
|
+
[rule, attr, rule.name.to_s]
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
89
98
|
# Returns [kwargs, hydrated_child_instances, delegate_values]
|
|
90
99
|
# — child instances come back so the caller can decorate
|
|
91
100
|
# parent/root links once the parent exists; delegate values
|
|
@@ -364,10 +373,11 @@ module Lutaml
|
|
|
364
373
|
# names eligible for #754/#790 lenient binding (multi-claimant
|
|
365
374
|
# names stay exact; per #841 leniency is sole-claimant-only).
|
|
366
375
|
def sole_claimant_names(plan)
|
|
367
|
-
plan
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
.
|
|
376
|
+
# Frozen with the plan: recomputing the tally per hydration
|
|
377
|
+
# showed in the #876-era profile as Enumerable#find/tally churn.
|
|
378
|
+
plan[:sole_claimants] ||= plan[:attr_rows]
|
|
379
|
+
.map { |rule, _attr| rule.name.to_s }.tally
|
|
380
|
+
.select { |_n, c| c == 1 }.keys
|
|
371
381
|
end
|
|
372
382
|
|
|
373
383
|
# Local-name attribute lookup on the source node, qualified
|
|
@@ -391,9 +401,12 @@ module Lutaml
|
|
|
391
401
|
want_tags = !row_tags.nil?
|
|
392
402
|
value.count.times do |i|
|
|
393
403
|
child = value.at(i)
|
|
394
|
-
|
|
404
|
+
# One FFI crossing per child: the name was read twice here
|
|
405
|
+
# (nil check + bucket key), doubling the hottest accessor.
|
|
406
|
+
name = child.name
|
|
407
|
+
next if name.nil? # content runs, read separately
|
|
395
408
|
|
|
396
|
-
(grouped[
|
|
409
|
+
(grouped[name] ||= []) << child
|
|
397
410
|
if want_tags && child.type_tag != 0
|
|
398
411
|
(tagged[child.type_tag] ||= []) << child
|
|
399
412
|
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.8.
|
|
4
|
+
version: 0.8.67
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-09-
|
|
11
|
+
date: 2026-09-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: base64
|