Method: Asciidoctor::Section#initialize

Defined in:
lib/asciidoctor/section.rb

#initialize(parent = nil, level = nil, numbered = false, opts = {}) ⇒ Section

Initialize an Asciidoctor::Section object.

Parameters:

  • parent (defaults to: nil)

    The parent AbstractBlock. If set, must be a Document or Section object (default: nil)

  • level (defaults to: nil)

    The Integer level of this section (default: 1 more than parent level or 1 if parent not defined)

  • numbered (defaults to: false)

    A Boolean indicating whether numbering is enabled for this Section (default: false)

  • opts (defaults to: {})

    An optional Hash of options (default: {})



46
47
48
49
50
51
52
53
54
55
# File 'lib/asciidoctor/section.rb', line 46

def initialize parent = nil, level = nil, numbered = false, opts = {}
  super parent, :section, opts
  if Section === parent
    @level, @special = level || (parent.level + 1), parent.special
  else
    @level, @special = level || 1, false
  end
  @numbered = numbered
  @index = 0
end