Class: MDOM::Heading

Inherits:
BlockNode show all
Defined in:
lib/mdom/nodes.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#attributes, #children, #parent, #type

Instance Method Summary collapse

Methods inherited from Node

#[], #ancestors, #append, #children?, #depth, #each_child, #empty?, #find, #find_all, #insert_after, #insert_before, #inspect, #plain_text, #pretty_print, #remove, #replace, #root, #text?, #to_markdown, #to_s, #walk

Constructor Details

#initialize(level, children: [], attributes: {}) ⇒ Heading

Returns a new instance of Heading.



42
43
44
45
# File 'lib/mdom/nodes.rb', line 42

def initialize(level, children: [], attributes: {})
  @level = level.to_i
  super(Types::HEADING, attributes: attributes.merge(level: @level), children: children)
end

Instance Attribute Details

#levelObject (readonly)

Returns the value of attribute level.



40
41
42
# File 'lib/mdom/nodes.rb', line 40

def level
  @level
end