Class: RD::Headline
- Inherits:
-
BlockElement
- Object
- Element
- BlockElement
- RD::Headline
- Includes:
- LabeledElement, NonterminalElement
- Defined in:
- lib/rd/block-element.rb
Constant Summary collapse
- MARK2LEVEL =
{ "=" => 1, "==" => 2, "===" => 3, "====" => 4, "+" => 5, "++" => 6 }
Instance Attribute Summary collapse
-
#level ⇒ Object
Returns the value of attribute level.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Attributes included from NonterminalElement
Attributes inherited from Element
Class Method Summary collapse
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #children ⇒ Object
-
#initialize(level_num) ⇒ Headline
constructor
A new instance of Headline.
Methods included from LabeledElement
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
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
#level ⇒ Object
Returns the value of attribute level.
22 23 24 |
# File 'lib/rd/block-element.rb', line 22 def level @level end |
#title ⇒ Object (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 |
#children ⇒ Object
49 50 51 |
# File 'lib/rd/block-element.rb', line 49 def children @title end |