Module: Coradoc::CoreModel::HasChildren

Included in:
ChildrenContent, StructuralElement
Defined in:
lib/coradoc/core_model/has_children.rb

Overview

Marker module for “this model exposes a children collection”.

Including this is the canonical way to opt a CoreModel class into children-based traversal. Downstream code (e.g. mirror’s CoreModelToMirror#element_children) dispatches on is_a?(HasChildren) rather than enumerating subclasses, so adding a new children-bearing class is purely additive (OCP).

ChildrenContent (the mixed-content auto-wrap behavior) includes HasChildren, so every class that mixes in ChildrenContent also satisfies HasChildren. Classes that carry typed block children only (StructuralElement, etc.) include HasChildren directly.

Instance Method Summary collapse

Instance Method Details

#has_children?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/coradoc/core_model/has_children.rb', line 18

def has_children?
  true
end