Class: Anydoc::Document

Inherits:
Data
  • Object
show all
Defined in:
lib/anydoc/document.rb,
sig/anydoc.rbs

Overview

The document model to_document returns.

Every class here is a Data, so instances are frozen, compare by value, answer to_h, and destructure in case/in:

case block
in Anydoc::Block[kind: :heading, level:, content:]
...
end

Variants (block kinds, link targets, ...) are a kind symbol plus the members that kind carries; members belonging to other kinds are nil.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#assetsArray[Asset] (readonly)

Returns the value of attribute assets.

Returns:



57
58
59
# File 'sig/anydoc.rbs', line 57

def assets
  @assets
end

#blocksArray[Block] (readonly)

Returns the value of attribute blocks.

Returns:



55
56
57
# File 'sig/anydoc.rbs', line 55

def blocks
  @blocks
end

#notesArray[Note] (readonly)

Returns the value of attribute notes.

Returns:



56
57
58
# File 'sig/anydoc.rbs', line 56

def notes
  @notes
end

Class Method Details

.new(blocks, notes, assets) ⇒ Document .new(blocks:, notes:, assets:) ⇒ Document

Overloads:



59
60
# File 'sig/anydoc.rbs', line 59

def self.new: (Array[Block] blocks, Array[Note] notes, Array[Asset] assets) -> Document
| (blocks: Array[Block], notes: Array[Note], assets: Array[Asset]) -> Document