Class: RRTF::SectionNode

Inherits:
CommandNode show all
Defined in:
lib/rrtf/node/section_node.rb

Overview

This class represents a section within an RTF document. Section nodes do not contain other nodes; instead, they mark the start of a new section.

Author:

  • Wesley Hileman

Instance Attribute Summary

Attributes inherited from CommandNode

#prefix, #split, #suffix, #wrap

Attributes inherited from ContainerNode

#children

Attributes inherited from Node

#parent

Instance Method Summary collapse

Methods inherited from CommandNode

#<<, #apply, #column_break, #footnote, #geometry, #image, #line_break, #link, #list, #paragraph, #section, #tab, #table, #to_rtf

Methods inherited from ContainerNode

#[], #each, #first, #last, #size, #to_rtf

Methods inherited from Node

#is_root?, #next_node, #previous_node, #root

Constructor Details

#initialize(parent, style = nil) ⇒ SectionNode

Returns a new instance of SectionNode



6
7
8
9
10
11
# File 'lib/rrtf/node/section_node.rb', line 6

def initialize(parent, style=nil)
  prefix = '\sect\sectd'
  prefix << style.prefix(parent.root) unless style.nil?

  super(parent, prefix, '', true, false)
end

Instance Method Details

#store(node) ⇒ Object

Overrides ContainerNode#store to prevent child nodes from being added to sections.

Raises:



17
18
19
# File 'lib/rrtf/node/section_node.rb', line 17

def store(node)
  RTFError.fire("Cannot add child nodes to section nodes: tried to add #{node}.")
end