Class: OoxmlParser::Inserted

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/docx_parser/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

#==, #boolean_attribute_value, #initialize, #parse_xml, #with_data?

Methods included from OoxmlObjectAttributeHelper

#attribute_enabled?, #option_enabled?

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



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

def author
  @author
end

#dateDate

Returns date of insert.

Returns:

  • (Date)

    date of insert



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

def date
  @date
end

#idInteger

Returns id of inserted.

Returns:

  • (Integer)

    id of inserted



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

def id
  @id
end

#runParagraphRun

Returns inserted run.

Returns:



17
18
19
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/inserted.rb', line 17

def run
  @run
end

#user_idString

Returns id of user.

Returns:

  • (String)

    id of user



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

def user_id
  @user_id
end

Instance Method Details

#parse(node) ⇒ Inserted

Parse Inserted object

Parameters:

  • node (Nokogiri::XML:Element)

    node to parse

Returns:



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

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