Class: OoxmlParser::PresentationComments
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::PresentationComments
- Defined in:
- lib/ooxml_parser/pptx_parser/presentation/presentation_comments.rb
Overview
Class for parsing ‘comment1.xml` file
Instance Attribute Summary collapse
-
#list ⇒ Array<PresentationComment>
readonly
List of comments.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#initialize(parent: nil) ⇒ PresentationComments
constructor
A new instance of PresentationComments.
-
#parse(file = "#{root_object.unpacked_folder}/#{root_object.root_subfolder}/comments/comment1.xml") ⇒ PresentationComments
Parse PresentationComments object.
Methods inherited from OOXMLDocumentObject
#==, #boolean_attribute_value, #parse_xml, #with_data?
Methods included from OoxmlObjectAttributeHelper
#attribute_enabled?, #option_enabled?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
#initialize(parent: nil) ⇒ PresentationComments
Returns a new instance of PresentationComments.
10 11 12 13 |
# File 'lib/ooxml_parser/pptx_parser/presentation/presentation_comments.rb', line 10 def initialize(parent: nil) @list = [] super end |
Instance Attribute Details
#list ⇒ Array<PresentationComment> (readonly)
Returns list of comments.
8 9 10 |
# File 'lib/ooxml_parser/pptx_parser/presentation/presentation_comments.rb', line 8 def list @list end |
Instance Method Details
#parse(file = "#{root_object.unpacked_folder}/#{root_object.root_subfolder}/comments/comment1.xml") ⇒ PresentationComments
Parse PresentationComments object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# 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 |