Class: OoxmlParser::Inserted

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/inserted.rb

Overview

Class for parsing ‘w:ins` tag - Inserted Run Content

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

#==, add_to_xmls_stack, copy_file_and_rename_to_zip, current_xml, dir, encrypted_file?, get_link_from_rels, #initialize, unzip_file, #with_data?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

This class inherits a constructor from OoxmlParser::OOXMLDocumentObject

Instance Attribute Details

#authorString

Returns author of insert.

Returns:

  • (String)

    author of insert



9
10
11
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/inserted.rb', line 9

def author
  @author
end

#dateDate

Returns date of insert.

Returns:

  • (Date)

    date of insert



11
12
13
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/inserted.rb', line 11

def date
  @date
end

#idInteger

Returns id of inserted.

Returns:

  • (Integer)

    id of inserted



7
8
9
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/inserted.rb', line 7

def id
  @id
end

#runParagraphRun

Returns inserted run.

Returns:



15
16
17
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/inserted.rb', line 15

def run
  @run
end

#user_idString

Returns id of user.

Returns:

  • (String)

    id of user



13
14
15
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/inserted.rb', line 13

def user_id
  @user_id
end

Instance Method Details

#parse(node) ⇒ Inserted

Parse Inserted object

Parameters:

  • node (Nokogiri::XML:Element)

    node to parse

Returns:



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/inserted.rb', line 20

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 = parse_date(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