Sha256: d5283acbb4d9379dafd73a991d2124257b7008b82e1a503d4b10ce6a1a47835e

Contents?: true

Size: 985 Bytes

Versions: 8

Compression:

Stored size: 985 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 = []
      @parent = parent
    end

    # Parse PresentationComments object
    # @param file [Nokogiri::XML:Element] node to parse
    # @return [PresentationComments] result of parsing
    def parse(file = "#{OOXMLDocumentObject.path_to_folder}/#{OOXMLDocumentObject.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

8 entries across 8 versions & 1 rubygems

Version Path
ooxml_parser-0.8.1 lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments.rb
ooxml_parser-0.8.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments.rb
ooxml_parser-0.7.2 lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments.rb
ooxml_parser-0.7.1 lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments.rb
ooxml_parser-0.7.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments.rb
ooxml_parser-0.6.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments.rb
ooxml_parser-0.5.1 lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments.rb
ooxml_parser-0.5.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments.rb