Class: RD::Headline

Inherits:
BlockElement show all
Includes:
LabeledElement, NonterminalElement
Defined in:
lib/rd/block-element.rb

Constant Summary collapse

MARK2LEVEL =
{
  "=" => 1,
  "==" => 2,
  "===" => 3,
  "====" => 4,
  "+" => 5,
  "++" => 6
}

Instance Attribute Summary collapse

Attributes included from NonterminalElement

#temporary_document_structure

Attributes inherited from Element

#parent

Class Method Summary collapse

Instance Method Summary collapse

Methods included from LabeledElement

#to_label

Methods included from NonterminalElement

#add_child, #add_child_under_document_struct, #add_children, #add_children_under_document_struct, #add_children_without_document_struct, #build, #each_child, #each_element, #make_child, #push_to_children, #under_temporary_document_structure

Methods inherited from Element

#inspect, #tree

Constructor Details

#initialize(level_num) ⇒ Headline

Returns a new instance of Headline.



25
26
27
28
29
# File 'lib/rd/block-element.rb', line 25

def initialize(level_num)
  super()
  @level = level_num
  @title = []
end

Instance Attribute Details

#levelObject

Returns the value of attribute level.



22
23
24
# File 'lib/rd/block-element.rb', line 22

def level
  @level
end

#titleObject (readonly)

Returns the value of attribute title.



23
24
25
# File 'lib/rd/block-element.rb', line 23

def title
  @title
end

Class Method Details

.mark_to_level(mark_str) ⇒ Object



44
45
46
47
# File 'lib/rd/block-element.rb', line 44

def Headline.mark_to_level(mark_str)
  MARK2LEVEL[mark_str] or
	raise ArgumentError, "#{mark_str} is irregular for Headline mark."
end

Instance Method Details

#accept(visitor) ⇒ Object



31
32
33
# File 'lib/rd/block-element.rb', line 31

def accept(visitor)
  visitor.visit_Headline(self)
end

#childrenObject



49
50
51
# File 'lib/rd/block-element.rb', line 49

def children
  @title
end