class DocTemplate::DocumentTOC

Constants

REGISTERED_METADATA

Public Class Methods

parse(opts = {}) click to toggle source

Build the ToC from the first available metadata. We're doing that to allow cross-subject data passing.

# File lib/doc_template/document_toc.rb, line 12
def self.parse(opts = {})
  metadata = REGISTERED_METADATA.detect { |m| opts[m]&.children.present? }
  Objects::TOCMetadata.new opts[metadata]
end