Sha256: a08ee2090febbe55bfdaf13a4d60e063f4e0beecbf628eb8f24e9ad1835df91a

Contents?: true

Size: 676 Bytes

Versions: 4

Compression:

Stored size: 676 Bytes

Contents

module RRTF
  # 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
  class SectionNode < CommandNode
    def initialize(parent, style=nil)
      prefix = '\sect\sectd'
      prefix << style.prefix(parent.root) unless style.nil?

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

    # Overrides {ContainerNode#store} to prevent child nodes from being
    # added to sections.
    #
    # @raise [RTFError] whenever called.
    def store(node)
      RTFError.fire("Cannot add child nodes to section nodes: tried to add #{node}.")
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rrtf-1.3.1 lib/rrtf/node/section_node.rb
rrtf-1.3.0 lib/rrtf/node/section_node.rb
rrtf-1.2.0 lib/rrtf/node/section_node.rb
rrtf-1.1.0 lib/rrtf/node/section_node.rb