Class: Glossarist::Figure
- Inherits:
-
NonVerbalEntity
- Object
- Lutaml::Model::Serializable
- NonVerbalEntity
- Glossarist::Figure
- Defined in:
- lib/glossarist/figure.rb
Overview
A dataset-level figure entity (ISO 10241-1 §6.5 — non-verbal representation).
Figures are authored once at ‘datasets/ds/figures/fig-id.yaml` and referenced by any number of concepts via stable ID — the same sharing pattern as bibliography entries. This is the rich, shareable counterpart to concept-owned NonVerbRep entries.
A Figure may carry multiple image variants (SVG + PNG + dark/light) for responsive rendering and accessibility. Composite figures use recursive subfigures.
Caption, description, and alt are localized (hash keyed by ISO 639 code).
Instance Method Summary collapse
-
#all_ids ⇒ Array<String>
Collect this figure’s ID and all descendant subfigure IDs.
-
#find_by_id(target_id) ⇒ Figure?
Recursively search for a subfigure (or self) by ID.
Methods inherited from NonVerbalEntity
Instance Method Details
#all_ids ⇒ Array<String>
Collect this figure’s ID and all descendant subfigure IDs.
48 49 50 |
# File 'lib/glossarist/figure.rb', line 48 def all_ids [id] + Array(subfigures).flat_map(&:all_ids) end |
#find_by_id(target_id) ⇒ Figure?
Recursively search for a subfigure (or self) by ID.
35 36 37 38 39 40 41 42 43 |
# File 'lib/glossarist/figure.rb', line 35 def find_by_id(target_id) return self if id == target_id Array(subfigures).each do |sub| found = sub.find_by_id(target_id) return found if found end nil end |