class OoxmlParser::Inserted
Class for parsing ‘w:ins` tag - Inserted
Run Content
Attributes
@return [Date] date of insert
@return [Integer] id of inserted
@return [ParagraphRun] inserted run
@return [String] id of user
Public Instance Methods
Source
# 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
Parse Inserted
object @param node [Nokogiri::XML:Element] node to parse @return [Inserted] result of parsing
Private Instance Methods
Source
# File lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/inserted.rb, line 50 def parse_date(value) DateTime.parse(value) rescue ArgumentError warn "Date #{value} is incorrect format" value end
Parse date and handle incorrect dates @param value [Sting] value of date @return [DateTime, String] if date correct or incorrect