Sha256: ce28241c8a2f2b08d9510bc079b36c7742b638b7caecd58ad492502e228b5de4

Contents?: true

Size: 1.04 KB

Versions: 40

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

module OoxmlParser
  # Class for parsing `p:cm` tag
  class PresentationComment < OOXMLDocumentObject
    # @return [Integer] id of author
    attr_reader :author_id
    # @return [OOXMLCoordinates] position of comment
    attr_reader :position
    # @return [String] text of comment
    attr_reader :text

    # @return [CommentAuthor] author of comment
    def author
      root_object.comment_authors.author_by_id(@author_id)
    end

    # Parse PresentationComment object
    # @param node [Nokogiri::XML:Element] node to parse
    # @return [PresentationComment] result of parsing
    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
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
ooxml_parser-0.33.0 lib/ooxml_parser/pptx_parser/presentation/presentation_comments/presentation_comment.rb
ooxml_parser-0.32.0 lib/ooxml_parser/pptx_parser/presentation/presentation_comments/presentation_comment.rb
ooxml_parser-0.31.0 lib/ooxml_parser/pptx_parser/presentation/presentation_comments/presentation_comment.rb
ooxml_parser-0.30.0 lib/ooxml_parser/pptx_parser/presentation/presentation_comments/presentation_comment.rb
ooxml_parser-0.29.0 lib/ooxml_parser/pptx_parser/presentation/presentation_comments/presentation_comment.rb
ooxml_parser-0.28.0 lib/ooxml_parser/pptx_parser/presentation/presentation_comments/presentation_comment.rb
ooxml_parser-0.27.0 lib/ooxml_parser/pptx_parser/presentation/presentation_comments/presentation_comment.rb
ooxml_parser-0.26.0 lib/ooxml_parser/pptx_parser/presentation/presentation_comments/presentation_comment.rb
ooxml_parser-0.25.0 lib/ooxml_parser/pptx_parser/presentation/presentation_comments/presentation_comment.rb
ooxml_parser-0.24.0 lib/ooxml_parser/pptx_parser/presentation/presentation_comments/presentation_comment.rb
ooxml_parser-0.23.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments/presentation_comment.rb
ooxml_parser-0.22.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments/presentation_comment.rb
ooxml_parser-0.21.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments/presentation_comment.rb
ooxml_parser-0.20.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments/presentation_comment.rb
ooxml_parser-0.19.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments/presentation_comment.rb
ooxml_parser-0.18.1 lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments/presentation_comment.rb
ooxml_parser-0.18.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments/presentation_comment.rb
ooxml_parser-0.17.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments/presentation_comment.rb
ooxml_parser-0.16.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments/presentation_comment.rb
ooxml_parser-0.15.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments/presentation_comment.rb