class OoxmlParser::FieldSimple

Class for parsing `w:fldSimple` tags

Attributes

instruction[R]

@return [String] instruction value

runs[R]

@return [Array<ParagraphRun>] instruction value

Public Class Methods

new(parent: nil) click to toggle source
Calls superclass method OoxmlParser::OOXMLDocumentObject::new
# File lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/field_simple.rb, line 11
def initialize(parent: nil)
  @runs = []
  super
end

Public Instance Methods

page_numbering?() click to toggle source

@return [True, False] is field simple page numbering

# File lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/field_simple.rb, line 37
def page_numbering?
  instruction.include?('PAGE')
end
parse(node) click to toggle source

Parse FieldSimple object @param node [Nokogiri::XML:Element] node to parse @return [FieldSimple] result of parsing

# File lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/field_simple.rb, line 19
def parse(node)
  node.attributes.each do |key, value|
    case key
    when 'instr'
      @instruction = value.value.to_s
    end
  end

  node.xpath('*').each do |node_child|
    case node_child.name
    when 'r'
      @runs << ParagraphRun.new(parent: self).parse(node_child)
    end
  end
  self
end