lutaml-model 0.8.81 → 0.8.83

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: 75aa028ab12c011d2d3c90b27d176d7096bcb7f0b09dbb521adf01d79dba8df1
4
- data.tar.gz: 523a5d23381afdfb840d7256855ea6e51ca04377dee765d5d215764bd4967af0
3
+ metadata.gz: 4e310af71c7b500226adc361854223a83e397520a48ab69760a80b47fd81b228
4
+ data.tar.gz: 7ad34288dc8429662936509d872e993eac0e76f31ff045f7c232273fd6912a9c
5
5
  SHA512:
6
- metadata.gz: 7a2723bfe0a8f6ef1049b5b5d3c5e987832f0397a12fc5f96b57bf0b74b0c2aeb5b9797d89591665fb2dd96f05724a4dcb764437ff332efc3ce2f4c484f79360
7
- data.tar.gz: a3812ee1c47c9633617dc07e8cfc2ed8cd102279039c4f76389d1dc490f1eaad07f3351bba192daefbf37d7f2132b72f84a036d70890c7e6a4d87fb65591a322
6
+ metadata.gz: 114ba7bf5b76479faca00e3b1a34cf58f9794e00b1ab31270109ca8f97a5a875d63ad1ec5ca1819db8e4f3d2083ff2bbc2b72b9f75c77b3a6800d606e3733615
7
+ data.tar.gz: bc410377e8d4fe638afebabcaf99b4dec94819b0e2414f8b276f3c80946250f39df39fa54f3aecd32ca825841830ed58de71a4f8f70f2a7e8dc8a405eab608e6
data/Gemfile CHANGED
@@ -44,7 +44,11 @@ gem "rexml"
44
44
  # Native engines stay development-only: every adapter detects and
45
45
  # degrades gracefully at runtime (safe requires + prefer-if-available).
46
46
  # yeptris ships no Windows prebuilt platform gem.
47
- gem "leptris"
47
+ # leptris floor: the plan hydrator's one-crossing snapshot
48
+ # (leptris_plan_value_children_snapshot) landed in 1.9.273.0; older
49
+ # gems fall back to accessor enumeration at runtime, but CI and dev
50
+ # resolve the snapshot-capable line.
51
+ gem "leptris", ">= 1.9.273.0"
48
52
  gem "teptris"
49
53
  gem "yeptris" unless Gem.win_platform?
50
54
  # TODO: revert rng branch to main when lutaml/rng#32 is merged
@@ -8,6 +8,38 @@ module Lutaml
8
8
  # model classes actually inherit from (lutaml-model#18).
9
9
  include Serialize
10
10
  extend ComparableModel::ClassMethods
11
+
12
+ # Ivars that must never take part in inspect output: they either
13
+ # walk the whole graph (@lutaml_parent climbs to the root, and
14
+ # parent-child mutual recursion never terminates under the
15
+ # default Object#inspect) or are bulky parse bookkeeping.
16
+ INSPECT_EXCLUDED_IVARS = %i[
17
+ @lutaml_parent @lutaml_root @lutaml_register @using_default
18
+ @element_order @attribute_order @encoding
19
+ ].freeze
20
+
21
+ # Bounded, Struct-like inspect: scalars by value, collections by
22
+ # size, child models by class name. The default Object#inspect
23
+ # recurses through @lutaml_parent and re-enters children forever
24
+ # on real parsed documents.
25
+ def inspect
26
+ parts = (instance_variables - INSPECT_EXCLUDED_IVARS).map do |iv|
27
+ "#{iv}=#{self.class.inspect_value(instance_variable_get(iv))}"
28
+ end
29
+ "#<#{self.class.name}#{' ' + parts.join(', ') unless parts.empty?}>"
30
+ end
31
+
32
+ class << self
33
+ def inspect_value(value)
34
+ case value
35
+ when nil, true, false, Numeric, Symbol then value.inspect
36
+ when String then value.inspect.length > 48 ? "#{value.inspect[0, 45]}...".inspect : value.inspect
37
+ when Array then "(#{value.size} items)"
38
+ when Hash then "{#{value.size} keys}"
39
+ else "##{value.class.name}"
40
+ end
41
+ end
42
+ end
11
43
  end
12
44
  end
13
45
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Lutaml
4
4
  module Model
5
- VERSION = "0.8.81"
5
+ VERSION = "0.8.83"
6
6
  end
7
7
  end
@@ -398,14 +398,22 @@ module Lutaml
398
398
  nil
399
399
  end
400
400
 
401
+ # Capability probe, not duck-typing: the snapshot landed in
402
+ # leptris 1.9.273.0; bundles still resolving an older gem
403
+ # (lockfiles, prefer-if-available resolution) must keep the
404
+ # accessor enumeration instead of NoMethodError-ing every
405
+ # XML parse (the 0.8.82 regression).
406
+ SNAPSHOT_CAPABLE =
407
+ Leptris::XML::PlanValue.method_defined?(:children_snapshot)
408
+
401
409
  def group_children(value, row_tags = nil)
410
+ return group_children_snapshot(value, row_tags) if SNAPSHOT_CAPABLE
411
+
402
412
  grouped = {}
403
413
  want_tags = !row_tags.nil?
404
414
  tagged = want_tags ? {} : nil
405
415
  value.count.times do |i|
406
416
  child = value.at(i)
407
- # One FFI crossing per child: the name was read twice here
408
- # (nil check + bucket key), doubling the hottest accessor.
409
417
  name = child.name
410
418
  next if name.nil? # content runs, read separately
411
419
 
@@ -417,6 +425,25 @@ module Lutaml
417
425
  [grouped, tagged]
418
426
  end
419
427
 
428
+ def group_children_snapshot(value, row_tags)
429
+ # One crossing per subtree: names/tags/children come back in
430
+ # parallel arrays from leptris_plan_value_children_snapshot.
431
+ names, tags, children = value.children_snapshot
432
+ grouped = {}
433
+ want_tags = !row_tags.nil?
434
+ tagged = want_tags ? {} : nil
435
+ names.each_with_index do |name, i|
436
+ next if name.nil? # content runs, read separately
437
+
438
+ child = children[i]
439
+ (grouped[name] ||= []) << child
440
+ if want_tags && tags[i] != 0
441
+ (tagged[tags[i]] ||= []) << child
442
+ end
443
+ end
444
+ [grouped, tagged]
445
+ end
446
+
420
447
  # Element children bucketed by local name, document order
421
448
  # preserved — the node-side mirror of group_children for
422
449
  # ordered-child hydration. Only built when the plan's subtree
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.81
4
+ version: 0.8.83
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-29 00:00:00.000000000 Z
11
+ date: 2026-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64