class OoxmlParser::PresentationComment

Class for parsing `p:cm` tag

Attributes

author_id[R]

@return [Integer] id of author

position[R]

@return [OOXMLCoordinates] position of comment

text[R]

@return [String] text of comment

Public Instance Methods

author() click to toggle source

@return [CommentAuthor] author of comment

# File lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments/presentation_comment.rb, line 14
def author
  root_object.comment_authors.author_by_id(@author_id)
end
parse(node) click to toggle source

Parse PresentationComment object @param node [Nokogiri::XML:Element] node to parse @return [PresentationComment] result of parsing

# File lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments/presentation_comment.rb, line 21
def parse(node)
  node.attributes.each do |key, value|
    case key
    when 'authorId'
      @author_id = value.value.to_i
    end
  end
  node.xpath('*').each do |node_child|
    case node_child.name
    when 'pos'
      @position = OOXMLCoordinates.parse(node_child, x_attr: 'x', y_attr: 'y')
    when 'text'
      @text = node_child.text.to_s
    end
  end
  self
end