Class: Glossarist::Figure

Inherits:
SharedNonVerbalEntity show all
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

Methods inherited from NonVerbalEntity

from_file

Instance Method Details

#all_idsObject



35
36
37
# File 'lib/glossarist/figure.rb', line 35

def all_ids
  [id] + Array(subfigures).flat_map(&:all_ids)
end

#find_by_id(target_id) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/glossarist/figure.rb', line 25

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