Class: OoxmlParser::Comment
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::Comment
- Defined in:
- lib/ooxml_parser/docx_parser/document_structure/comments/comment.rb
Overview
Comment Data
Instance Attribute Summary collapse
-
#id ⇒ Integer
readonly
Id of comment.
-
#paragraphs ⇒ Array<DocxParagraph>
readonly
Array of paragraphs.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#initialize(id = nil, paragraphs = [], parent: nil) ⇒ Comment
constructor
A new instance of Comment.
-
#parse(node) ⇒ Comment
Parse Comment object.
Methods inherited from OOXMLDocumentObject
#==, #boolean_attribute_value, #parse_xml, #with_data?
Methods included from OoxmlObjectAttributeHelper
#attribute_enabled?, #option_enabled?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
#initialize(id = nil, paragraphs = [], parent: nil) ⇒ Comment
Returns a new instance of Comment.
11 12 13 14 15 |
# File 'lib/ooxml_parser/docx_parser/document_structure/comments/comment.rb', line 11 def initialize(id = nil, paragraphs = [], parent: nil) @id = id @paragraphs = paragraphs super(parent: parent) end |
Instance Attribute Details
#id ⇒ Integer (readonly)
Returns id of comment.
7 8 9 |
# File 'lib/ooxml_parser/docx_parser/document_structure/comments/comment.rb', line 7 def id @id end |
#paragraphs ⇒ Array<DocxParagraph> (readonly)
Returns array of paragraphs.
9 10 11 |
# File 'lib/ooxml_parser/docx_parser/document_structure/comments/comment.rb', line 9 def paragraphs @paragraphs end |
Instance Method Details
#parse(node) ⇒ Comment
Parse Comment object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/ooxml_parser/docx_parser/document_structure/comments/comment.rb', line 20 def parse(node) node.attributes.each do |key, value| case key when 'id' @id = value.value.to_i end end node.xpath('*').each do |node_child| case node_child.name when 'p' @paragraphs << DocxParagraph.new.parse(node_child, 0, parent: self) end end self end |