Sha256: 1d12fafb0e01dc938e4f2474aa2884cffc4d60a20f87257e3b8d14855547e6a6

Contents?: true

Size: 959 Bytes

Versions: 1

Compression:

Stored size: 959 Bytes

Contents

# frozen_string_literal: true

require_relative 'presentation_comments/presentation_comment'
module OoxmlParser
  # Class for parsing `comment1.xml` file
  class PresentationComments < OOXMLDocumentObject
    # @return [Array<PresentationComment>] list of comments
    attr_reader :list

    def initialize(parent: nil)
      @list = []
      super
    end

    # Parse PresentationComments object
    # @param file [Nokogiri::XML:Element] node to parse
    # @return [PresentationComments] result of parsing
    def parse(file = "#{root_object.unpacked_folder}/#{root_object.root_subfolder}/comments/comment1.xml")
      return nil unless File.exist?(file)

      document = parse_xml(File.open(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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ooxml_parser-0.30.0 lib/ooxml_parser/pptx_parser/presentation/presentation_comments.rb