Sha256: f020118a69f45497a040ea36aed875a9aac8893c44ed0823674d4df8558b2d6a
Contents?: true
Size: 924 Bytes
Versions: 28
Compression:
Stored size: 924 Bytes
Contents
# frozen_string_literal: true require_relative 'comments/comment' module OoxmlParser # Class for parsing `comments.xml` file class Comments < OOXMLDocumentObject # @return [Array<Comment>] list of comments attr_reader :comments_array def initialize(params = {}) @comments_array = [] @file = params.fetch(:file, "#{OOXMLDocumentObject.path_to_folder}word/comments.xml") super(parent: params[:parent]) end # @return [Comment] accessor def [](key) @comments_array[key] end # Parse CommentsExtended object # @return [Comments] result of parsing def parse return nil unless File.file?(@file) doc = parse_xml(@file) doc.xpath('w:comments/*').each do |node_child| case node_child.name when 'comment' @comments_array << Comment.new(parent: self).parse(node_child) end end self end end end
Version data entries
28 entries across 28 versions & 1 rubygems