Class: OoxmlParser::FieldSimple
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::FieldSimple
- Defined in:
- lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/field_simple.rb
Overview
Class for parsing ‘w:fldSimple` tags
Instance Attribute Summary collapse
-
#instruction ⇒ String
readonly
Instruction value.
-
#runs ⇒ Array<ParagraphRun>
readonly
Instruction value.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#initialize(parent: nil) ⇒ FieldSimple
constructor
A new instance of FieldSimple.
-
#page_numbering? ⇒ True, False
Is field simple page numbering.
-
#parse(node) ⇒ FieldSimple
Parse FieldSimple 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(parent: nil) ⇒ FieldSimple
Returns a new instance of FieldSimple.
11 12 13 14 |
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/field_simple.rb', line 11 def initialize(parent: nil) @runs = [] super end |
Instance Attribute Details
#instruction ⇒ String (readonly)
Returns instruction value.
7 8 9 |
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/field_simple.rb', line 7 def instruction @instruction end |
#runs ⇒ Array<ParagraphRun> (readonly)
Returns instruction value.
9 10 11 |
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/field_simple.rb', line 9 def runs @runs end |
Instance Method Details
#page_numbering? ⇒ True, False
Returns is field simple page numbering.
37 38 39 |
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/field_simple.rb', line 37 def page_numbering? instruction.include?('PAGE') end |
#parse(node) ⇒ FieldSimple
Parse FieldSimple object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/field_simple.rb', line 19 def parse(node) node.attributes.each do |key, value| case key when 'instr' @instruction = value.value.to_s end end node.xpath('*').each do |node_child| case node_child.name when 'r' @runs << ParagraphRun.new(parent: self).parse(node_child) end end self end |