Sha256: b99c8db507634e4ebb8cef78973da232dac8eb8f7af5bee5098202f65af97da3
Contents?: true
Size: 1.14 KB
Versions: 3
Compression:
Stored size: 1.14 KB
Contents
require_relative 'comments_extended/comment_extended' module OoxmlParser # Class for parsing `commentsExtended.xml` file class CommentsExtended < OOXMLDocumentObject def initialize(parent: nil) @comments_extended_array = [] @parent = parent end # @return [Array, CommentsExtended] accessor def [](key) @comments_extended_array[key] end # Parse CommentsExtended object # @return [CommentsExtended] result of parsing def parse file_to_parse = OOXMLDocumentObject.path_to_folder + 'word/commentsExtended.xml' return nil unless File.exist?(file_to_parse) doc = Nokogiri::XML(File.open(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 # @param id [Integer] id of comment # @return [CommentExtended] comment by id def by_id(id) @comments_extended_array.each do |cur_comment| return cur_comment if cur_comment.paragraph_id == id end nil end end end
Version data entries
3 entries across 3 versions & 1 rubygems