class OoxmlParser::PresentationComments

Class for parsing ‘comment1.xml` file

Attributes

list[R]

@return [Array<PresentationComment>] list of comments

Public Class Methods

new(parent: nil) click to toggle source
Calls superclass method OoxmlParser::OOXMLDocumentObject::new
# File lib/ooxml_parser/pptx_parser/presentation/presentation_comments.rb, line 10
def initialize(parent: nil)
  @list = []
  super
end

Public Instance Methods

parse(file = " click to toggle source

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

# File lib/ooxml_parser/pptx_parser/presentation/presentation_comments.rb, line 18
def parse(file = "#{root_object.unpacked_folder}/#{root_object.root_subfolder}/comments/comment1.xml")
  return nil unless File.exist?(file)

  document = parse_xml(file)
  node = document.xpath('*').first

  node.xpath('*').each do |node_child|
    case node_child.name
    when 'cm'
      @list << PresentationComment.new(parent: self).parse(node_child)
    end
  end
  self
end