Class: OoxmlParser::PresentationCommentAuthor

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comment/presentation_comment_author.rb

Constant Summary

Constants inherited from OOXMLDocumentObject

OOXMLDocumentObject::DEFAULT_DIRECTORY_FOR_MEDIA

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

#==, add_to_xmls_stack, copy_file_and_rename_to_zip, copy_media_file, current_xml, dir, encrypted_file?, get_link_from_rels, media_folder, option_enabled?, unzip_file

Constructor Details

#initialize(id, name, initials) ⇒ PresentationCommentAuthor

Returns a new instance of PresentationCommentAuthor.



5
6
7
8
9
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comment/presentation_comment_author.rb', line 5

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

Instance Attribute Details

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comment/presentation_comment_author.rb', line 3

def id
  @id
end

#initialsObject

Returns the value of attribute initials.



3
4
5
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comment/presentation_comment_author.rb', line 3

def initials
  @initials
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comment/presentation_comment_author.rb', line 3

def name
  @name
end

Class Method Details

.parseObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comment/presentation_comment_author.rb', line 11

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