Sha256: 0f3afeb05c367d19b36cdb056daa0ec0052bf151b4b08d0bfe175411068da51f
Contents?: true
Size: 883 Bytes
Versions: 5
Compression:
Stored size: 883 Bytes
Contents
# frozen_string_literal: true module OoxmlParser # Comment Data class Comment < OOXMLDocumentObject # @return [Integer] id of comment attr_reader :id # @return [Array<DocxParagraph>] array of paragraphs attr_reader :paragraphs def initialize(id = nil, paragraphs = [], parent: nil) @id = id @paragraphs = paragraphs @parent = parent end # Parse Comment object # @param node [Nokogiri::XML:Element] node to parse # @return [Comment] result of parsing def parse(node) node.attributes.each do |key, value| case key when 'id' @id = value.value.to_i end end node.xpath('*').each do |node_child| case node_child.name when 'p' @paragraphs << DocxParagraph.new.parse(node_child, 0, parent: self) end end self end end end
Version data entries
5 entries across 5 versions & 1 rubygems