Class: OoxmlParser::CommentsExtended
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::CommentsExtended
- Defined in:
- lib/ooxml_parser/docx_parser/document_structure/comments_extended.rb
Overview
Class for parsing ‘commentsExtended.xml` file
Instance Attribute Summary
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#[](key) ⇒ Array, CommentsExtended
Accessor.
-
#by_id(id) ⇒ CommentExtended
Comment by id.
-
#initialize(parent: nil) ⇒ CommentsExtended
constructor
A new instance of CommentsExtended.
-
#parse ⇒ CommentsExtended
Parse CommentsExtended 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) ⇒ CommentsExtended
Returns a new instance of CommentsExtended.
7 8 9 10 |
# File 'lib/ooxml_parser/docx_parser/document_structure/comments_extended.rb', line 7 def initialize(parent: nil) @comments_extended_array = [] super end |
Instance Method Details
#[](key) ⇒ Array, CommentsExtended
Returns accessor.
13 14 15 |
# File 'lib/ooxml_parser/docx_parser/document_structure/comments_extended.rb', line 13 def [](key) @comments_extended_array[key] end |
#by_id(id) ⇒ CommentExtended
Returns comment by id.
35 36 37 38 39 40 |
# File 'lib/ooxml_parser/docx_parser/document_structure/comments_extended.rb', line 35 def by_id(id) @comments_extended_array.each do |cur_comment| return cur_comment if cur_comment.paragraph_id == id end nil end |
#parse ⇒ CommentsExtended
Parse CommentsExtended object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/ooxml_parser/docx_parser/document_structure/comments_extended.rb', line 19 def parse file_to_parse = "#{root_object.unpacked_folder}word/commentsExtended.xml" return nil unless File.exist?(file_to_parse) doc = parse_xml(file_to_parse) doc.xpath('w15:commentsEx/*').each do |node_child| case node_child.name when 'commentEx' @comments_extended_array << CommentExtended.new(parent: self).parse(node_child) end end self end |