class OoxmlParser::Comment

Comment Data

Attributes

id[R]

@return [Integer] id of comment

paragraphs[R]

@return [Array<DocxParagraph>] array of paragraphs

Public Class Methods

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

Public Instance Methods

parse(node) click to toggle source

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

# File lib/ooxml_parser/docx_parser/docx_data/document_structure/comments/comment.rb, line 20
def parse(node)
  node.attributes.each do |key, value|
    case key
    when 'id'
      @id = value.value.to_i
    end
  end

  node.xpath('*').each do |node_child|
    case node_child.name
    when 'p'
      @paragraphs << DocxParagraph.new.parse(node_child, 0, parent: self)
    end
  end
  self
end