Class: OoxmlParser::InstructionText

Inherits:
TextValue show all
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

#value

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from TextValue

#parse

Methods inherited from OOXMLDocumentObject

#==, #boolean_attribute_value, #initialize, #parse_xml, #with_data?

Methods included from OoxmlObjectAttributeHelper

#attribute_enabled?, #option_enabled?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

This class inherits a constructor from OoxmlParser::OOXMLDocumentObject

Instance Method Details

#hyperlink?Boolean

Returns is current object for hyperlink.

Returns:

  • (Boolean)

    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.

Returns:

  • (Boolean)

    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

Returns convert InstructionText to Hyperlink.

Returns:

  • (Hyperlink)

    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