Sha256: 66ecb854f1599cdce30c319cf649078666611f6f9fbae24d9d331877ac27eaa5

Contents?: true

Size: 860 Bytes

Versions: 5

Compression:

Stored size: 860 Bytes

Contents

module OoxmlParser
  class PresentationCommentAuthor < OOXMLDocumentObject
    attr_accessor :id, :name, :initials

    def initialize(id, name, initials)
      @id = id
      @name = name
      @initials = initials
    end

    def self.parse
      comment_authors = {}
      begin
        doc = Nokogiri::XML(File.open(OOXMLDocumentObject.path_to_folder + 'ppt/commentAuthors.xml'))
      rescue StandardError
        raise "Can't find commentAuthors.xml in #{OOXMLDocumentObject.path_to_folder}/ppt folder"
      end
      doc.xpath('p:cmAuthorLst/p:cmAuthor').each do |author_node|
        comment_authors[author_node.attribute('id').value] = PresentationCommentAuthor.new(
          author_node.attribute('id').value, author_node.attribute('name').value, author_node.attribute('initials').value
        )
      end
      comment_authors
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ooxml_parser-0.4.1 lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comment/presentation_comment_author.rb
ooxml_parser-0.4.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comment/presentation_comment_author.rb
ooxml_parser-0.3.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comment/presentation_comment_author.rb
ooxml_parser-0.2.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comment/presentation_comment_author.rb
ooxml_parser-0.1.2 lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comment/presentation_comment_author.rb