Class: Coradoc::Html::Transform::FromCoreModel

Inherits:
Object
  • Object
show all
Defined in:
lib/coradoc/html/transform/from_core_model.rb

Overview

Transforms CoreModel models to HTML output

This transformer converts CoreModel to structures suitable for HTML rendering. Note: The HTML converters already support CoreModel directly, so this transformer primarily passes through the CoreModel.

Class Method Summary collapse

Class Method Details

.transform(model) ⇒ Object

Transform a CoreModel to HTML-ready structure

Parameters:

  • model (Coradoc::CoreModel::Base)

    CoreModel to transform

Returns:

  • (Object)

    HTML-ready structure



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/coradoc/html/transform/from_core_model.rb', line 17

def transform(model)
  case model
  when Coradoc::CoreModel::Base
    # HTML converters already support CoreModel directly
    model
  when Array
    model.map { |item| transform(item) }
  else
    model
  end
end