Class: Coradoc::CoreModel::StructuralElement
- Inherits:
-
Base
- Object
- Lutaml::Model::Serializable
- Base
- Coradoc::CoreModel::StructuralElement
- Defined in:
- lib/coradoc/core_model/structural_element.rb
Overview
Base class for structural elements
Represents document structure elements that organize content. Typed subclasses (SectionElement, DocumentElement, etc.) express their role via the class hierarchy — the class IS the type.
Structural elements can contain other elements (blocks, lists, etc.) and can be nested hierarchically to represent document structure.
Direct Known Subclasses
DocumentElement, HeaderElement, PreambleElement, SectionElement
Instance Attribute Summary collapse
-
#attributes ⇒ Metadata?
Document-level attributes (typed key-value pairs).
-
#children ⇒ Array<Base>?
Child elements (sections, blocks, etc.).
-
#content ⇒ String?
Text content of the element.
-
#level ⇒ Integer?
Hierarchical level (1-6 for sections).
Attributes inherited from Base
#element_attributes, #id, #metadata_entries, #title
Class Method Summary collapse
Instance Method Summary collapse
- #document? ⇒ Boolean
-
#element_type ⇒ Object
Derived element_type string for backward compatibility with templates and legacy consumers.
- #header? ⇒ Boolean
- #heading_level ⇒ Object
- #preamble? ⇒ Boolean
- #section? ⇒ Boolean
Methods inherited from Base
#accept, #attr, #metadata, #semantically_equivalent?, #set_attr, #set_metadata
Instance Attribute Details
#attributes ⇒ Metadata?
Returns document-level attributes (typed key-value pairs).
28 |
# File 'lib/coradoc/core_model/structural_element.rb', line 28 attribute :attributes, Metadata |
#children ⇒ Array<Base>?
Returns child elements (sections, blocks, etc.).
24 |
# File 'lib/coradoc/core_model/structural_element.rb', line 24 attribute :children, Base, collection: true |
#content ⇒ String?
Returns text content of the element.
20 |
# File 'lib/coradoc/core_model/structural_element.rb', line 20 attribute :content, :string |
#level ⇒ Integer?
Returns hierarchical level (1-6 for sections).
16 |
# File 'lib/coradoc/core_model/structural_element.rb', line 16 attribute :level, :integer |
Class Method Details
.element_type_name ⇒ Object
46 47 48 |
# File 'lib/coradoc/core_model/structural_element.rb', line 46 def element_type_name nil end |
Instance Method Details
#document? ⇒ Boolean
35 |
# File 'lib/coradoc/core_model/structural_element.rb', line 35 def document? = false |
#element_type ⇒ Object
Derived element_type string for backward compatibility with templates and legacy consumers. Subclasses override this.
41 42 43 |
# File 'lib/coradoc/core_model/structural_element.rb', line 41 def element_type self.class.element_type_name end |
#header? ⇒ Boolean
37 |
# File 'lib/coradoc/core_model/structural_element.rb', line 37 def header? = false |
#heading_level ⇒ Object
30 31 32 |
# File 'lib/coradoc/core_model/structural_element.rb', line 30 def heading_level level || 1 end |
#preamble? ⇒ Boolean
36 |
# File 'lib/coradoc/core_model/structural_element.rb', line 36 def preamble? = false |
#section? ⇒ Boolean
34 |
# File 'lib/coradoc/core_model/structural_element.rb', line 34 def section? = false |