Class: OoxmlParser::Paragraph
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::Paragraph
- Defined in:
- lib/ooxml_parser/common_parser/common_data/paragraph.rb
Overview
Class for parsing ‘p` tags
Instance Attribute Summary collapse
-
#alternate_content ⇒ AlternateContent
Alternate content data.
-
#formulas ⇒ Object
Returns the value of attribute formulas.
-
#properties ⇒ Object
Returns the value of attribute properties.
-
#runs ⇒ Object
(also: #characters, #character_style_array)
Returns the value of attribute runs.
-
#text_field ⇒ Object
Returns the value of attribute text_field.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#initialize(runs = [], formulas = [], parent: nil) ⇒ Paragraph
constructor
A new instance of Paragraph.
-
#parse(node) ⇒ Paragraph
Parse Paragraph object.
Methods inherited from OOXMLDocumentObject
#==, add_to_xmls_stack, copy_file_and_rename_to_zip, current_xml, dir, encrypted_file?, get_link_from_rels, unzip_file, #with_data?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
#initialize(runs = [], formulas = [], parent: nil) ⇒ Paragraph
Returns a new instance of Paragraph.
11 12 13 14 15 16 17 18 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph.rb', line 11 def initialize(runs = [], formulas = [], parent: nil) @runs = runs @formulas = formulas @runs = [] @parent = parent end |
Instance Attribute Details
#alternate_content ⇒ AlternateContent
Returns alternate content data.
9 10 11 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph.rb', line 9 def alternate_content @alternate_content end |
#formulas ⇒ Object
Returns the value of attribute formulas.
7 8 9 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph.rb', line 7 def formulas @formulas end |
#properties ⇒ Object
Returns the value of attribute properties.
7 8 9 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph.rb', line 7 def properties @properties end |
#runs ⇒ Object Also known as: characters, character_style_array
Returns the value of attribute runs.
7 8 9 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph.rb', line 7 def runs @runs end |
#text_field ⇒ Object
Returns the value of attribute text_field.
7 8 9 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph.rb', line 7 def text_field @text_field end |
Instance Method Details
#parse(node) ⇒ Paragraph
Parse Paragraph object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph.rb', line 28 def parse(node) node.xpath('*').each do |node_child| case node_child.name when 'pPr' @properties = ParagraphProperties.new(parent: self).parse(node_child) when 'fld' @text_field = TextField.new(parent: self).parse(node_child) when 'r' @runs << ParagraphRun.new(parent: self).parse(node_child) when 'AlternateContent' @alternate_content = AlternateContent.new(parent: self).parse(node_child) end end self end |