opencdd 0.2.2 → 0.2.3

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: 9fc81f8bcb07863fa5c69e681de61f2d198f39bc81a0fc59da37ec987c9b2a1f
4
- data.tar.gz: 90e951f6174389ecab19ae8170b3e23ed8ff3e7d79602505f9ae2bd517369384
3
+ metadata.gz: '0782b45aeee8bad692974cd0480dd8430f13c92f405760188a13df3e3b2c77ed'
4
+ data.tar.gz: a4e26b1842e838b8e9464d0ff782ec745d59b96e9f5637e8630de9343218805d
5
5
  SHA512:
6
- metadata.gz: c20ebb47fc6253b09cc1dc083066aadb552af65606c77400c932a3f78ac1ee08e78b431eb69a7409a1c9ec9dd2059b7d6d3a6ce78c0143393b6fd80f8c6a89dc
7
- data.tar.gz: 50c2e7547728041faa53a8acc143e545628e5d3750d61dd55b36e2cd7ec980ee0a7af4755e2fafd8024f0d67a9e4c9cdb9f2140274ae893d8aba29906d26f185
6
+ metadata.gz: 12267bf271cabfeedb613766a6f679843d3be7fe542a96b097c9804ae7014c2a6fa5d96c2bafeeeefdaf7bbd9878ccde9aeca85423bbc40ad07ef3b7fb1428b7
7
+ data.tar.gz: 23a8abce3684e130d3e7bff46973b579c3a71d9212153aea4f216314e6ab9ff7747b3a0030ecb1a0cd9134a3dab6dc83b782132d83a4feea8c2c36052994bfb0
@@ -109,6 +109,7 @@ module Opencdd
109
109
  def value_terms ; @entities_by_type[:value_term] || [] ; end
110
110
  def relations ; @entities_by_type[:relation] || [] ; end
111
111
  def view_controls ; @entities_by_type[:view_control] || [] ; end
112
+ def list_of_units ; @entities_by_type[:list_of_unit] || [] ; end
112
113
 
113
114
  def entities_of_type(type)
114
115
  @entities_by_type[type.to_sym] || []
@@ -53,6 +53,10 @@ module Opencdd
53
53
  @nodes << view_control_node(vc)
54
54
  end
55
55
 
56
+ def visit_list_of_unit(lou)
57
+ @nodes << list_of_unit_node(lou)
58
+ end
59
+
56
60
  # ─────────────────────────────────────────────────────────────
57
61
  # Public per-entity payload API
58
62
  #
@@ -73,6 +77,7 @@ module Opencdd
73
77
  Opencdd::ValueTerm => :value_term_node,
74
78
  Opencdd::Relation => :relation_node,
75
79
  Opencdd::ViewControl => :view_control_node,
80
+ Opencdd::ListUnit => :list_of_unit_node,
76
81
  }.freeze
77
82
 
78
83
  def payload_for(entity, database: nil)
@@ -125,6 +130,10 @@ module Opencdd
125
130
  entity_payload(vc).merge(type: "view_control").compact
126
131
  end
127
132
 
133
+ def list_of_unit_node(lou)
134
+ entity_payload(lou).merge(type: "list_of_unit").compact
135
+ end
136
+
128
137
  private
129
138
 
130
139
  # Iterates every declared field on the entity's class (walking
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Opencdd
4
+ class ListUnit < Opencdd::Entity
5
+ end
6
+ end
@@ -257,7 +257,7 @@ module Opencdd
257
257
  list_of_unit = MetaClass.new(
258
258
  irdi: "MDC_C0100",
259
259
  name: "ListOfUnit",
260
- entity_class: Opencdd::Entity,
260
+ entity_class: Opencdd::ListUnit,
261
261
  type: :list_of_unit,
262
262
  allowed_property_ids: common,
263
263
  )
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Opencdd
4
- VERSION = "0.2.2"
4
+ VERSION = "0.2.3"
5
5
  end
@@ -18,6 +18,7 @@ module Opencdd
18
18
  visit_value_terms(database)
19
19
  visit_relations(database)
20
20
  visit_view_controls(database)
21
+ visit_list_of_units(database)
21
22
  self
22
23
  end
23
24
 
@@ -55,6 +56,10 @@ module Opencdd
55
56
  each_sorted(database.view_controls) { |v| visit_view_control(v) }
56
57
  end
57
58
 
59
+ def visit_list_of_units(database)
60
+ each_sorted(database.list_of_units) { |l| visit_list_of_unit(l) }
61
+ end
62
+
58
63
  # Single source of truth for sort-by-code traversal. Was
59
64
  # duplicated as `.sort_by { |x| x.code.to_s }` in 7 methods.
60
65
  def each_sorted(entities)
@@ -85,6 +90,10 @@ module Opencdd
85
90
  @seen << vc.irdi if vc.irdi
86
91
  end
87
92
 
93
+ def visit_list_of_unit(lou)
94
+ @seen << lou.irdi if lou.irdi
95
+ end
96
+
88
97
  def reset!
89
98
  @seen.clear
90
99
  self
data/lib/opencdd.rb CHANGED
@@ -28,6 +28,7 @@ module Opencdd
28
28
  autoload :ValueTerm, "opencdd/value_term"
29
29
  autoload :Relation, "opencdd/relation"
30
30
  autoload :ViewControl, "opencdd/view_control"
31
+ autoload :ListUnit, "opencdd/list_unit"
31
32
 
32
33
  autoload :Database, "opencdd/database"
33
34
  autoload :EffectiveProperties, "opencdd/effective_properties"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opencdd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenCDD contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-07-22 00:00:00.000000000 Z
11
+ date: 2026-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: roo
@@ -251,6 +251,7 @@ files:
251
251
  - lib/opencdd/irdi.rb
252
252
  - lib/opencdd/klass.rb
253
253
  - lib/opencdd/languages.rb
254
+ - lib/opencdd/list_unit.rb
254
255
  - lib/opencdd/meta_class.rb
255
256
  - lib/opencdd/model.rb
256
257
  - lib/opencdd/model/entity_store.rb