Class: OoxmlParser::InstructionText
- Inherits:
-
TextValue
- Object
- OOXMLDocumentObject
- TextValue
- OoxmlParser::InstructionText
- Defined in:
- lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_run/instruction_text.rb
Overview
Class for parsing ‘w:instrText` object
Instance Attribute Summary
Attributes inherited from TextValue
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#hyperlink? ⇒ Boolean
Is current object for hyperlink.
-
#page_number? ⇒ Boolean
Is current object for page number.
-
#to_hyperlink ⇒ Hyperlink
Convert InstructionText to Hyperlink.
Methods inherited from TextValue
Methods inherited from OOXMLDocumentObject
#==, #boolean_attribute_value, #initialize, #parse_xml, #with_data?
Methods included from OoxmlObjectAttributeHelper
#attribute_enabled?, #option_enabled?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
This class inherits a constructor from OoxmlParser::OOXMLDocumentObject
Instance Method Details
#hyperlink? ⇒ Boolean
Returns is current object for hyperlink.
7 8 9 |
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_run/instruction_text.rb', line 7 def hyperlink? value.include?('HYPERLINK') end |
#page_number? ⇒ Boolean
Returns is current object for page number.
12 13 14 |
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_run/instruction_text.rb', line 12 def page_number? value.match?(/PAGE\s+\\\*/) end |
#to_hyperlink ⇒ Hyperlink
Returns convert InstructionText to Hyperlink.
17 18 19 20 |
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_run/instruction_text.rb', line 17 def to_hyperlink Hyperlink.new(value.sub('HYPERLINK ', '').split(' \\o ').first, value.sub('HYPERLINK', '').split(' \\o ').last) end |