Sha256: b89c6d6871fc377f043807c61c53756d70fd403dcdcb837d81228072ae3c49bb

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

module OoxmlParser
  # Class for parsing `w:ins` tag - Inserted Run Content
  class Inserted < OOXMLDocumentObject
    # @return [Integer] id of inserted
    attr_accessor :id
    # @return [String] author of insert
    attr_accessor :author
    # @return [Date] date of insert
    attr_accessor :date
    # @return [String] id of user
    attr_accessor :user_id
    # @return [ParagraphRun] inserted run
    attr_accessor :run

    # Parse Inserted object
    # @param node [Nokogiri::XML:Element] node to parse
    # @return [Inserted] result of parsing
    def parse(node)
      node.attributes.each do |key, value|
        case key
        when 'id'
          @id = value.value.to_i
        when 'author'
          @author = value.value.to_s
        when 'date'
          @date = DateTime.parse(value.value.to_s)
        when 'oouserid'
          @user_id = value.value.to_s
        end
      end

      node.xpath('*').each do |node_child|
        case node_child.name
        when 'r'
          @run = ParagraphRun.new(parent: self).parse(node_child)
        end
      end
      self
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ooxml_parser-0.2.0 lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/inserted.rb