Class: Coradoc::Html::Transform::ToCoreModel
- Inherits:
-
Object
- Object
- Coradoc::Html::Transform::ToCoreModel
- Defined in:
- lib/coradoc/html/transform/to_core_model.rb
Overview
Transforms Nokogiri HTML nodes to CoreModel
Nokogiri serves as the HTML model layer. This transformer converts Nokogiri::XML::Document or Nokogiri::XML::Node objects into CoreModel by delegating to the existing input converter pipeline.
Class Method Summary collapse
-
.transform(model) ⇒ Coradoc::CoreModel::Base
Transform an HTML model (Nokogiri node) to CoreModel.
Class Method Details
.transform(model) ⇒ Coradoc::CoreModel::Base
Transform an HTML model (Nokogiri node) to CoreModel
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/coradoc/html/transform/to_core_model.rb', line 21 def transform(model) case model when Coradoc::CoreModel::Base model when Nokogiri::XML::Document, Nokogiri::XML::Node ::Coradoc::Input::Html::HtmlConverter.to_core_model(model) when Array model.map { |item| transform(item) } else model end end |