Method: MdnQuery::Section#initialize

Defined in:
lib/mdn_query/section.rb

#initialize(name, level: 1, parent: nil) ⇒ MdnQuery::Section

Creates a new section.

Parameters:

  • name (String)

    the name and title of the section

  • level (Fixnum) (defaults to: 1)

    the level of the section

  • parent (MdnQuery::Section) (defaults to: nil)

    the parent section



25
26
27
28
29
30
31
# File 'lib/mdn_query/section.rb', line 25

def initialize(name, level: 1, parent: nil)
  @name = escape_html_tags(name)
  @level = level
  @parent = parent
  @text = []
  @children = []
end