Method: Asciidoctor::AbstractBlock#<<

Defined in:
lib/asciidoctor/abstract_block.rb

#<<(block) ⇒ The Also known as: append

Append a content block to this block's list of blocks.

Examples:

block = Block.new(parent, :preamble, content_model: :compound)
block << Block.new(block, :paragraph, source: 'p1')
block << Block.new(block, :paragraph, source: 'p2')
block.blocks?
# => true
block.blocks.size
# => 2

Parameters:

  • block

    The new child block.

Returns:

  • (The)

    parent Block


114
115
116
117
118
# File 'lib/asciidoctor/abstract_block.rb', line 114

def << block
  block.parent = self unless block.parent == self
  @blocks << block
  self
end