Sha256: e11c0b110bd5cf584690d19547c8723f365ceb27e83933791f0f5d375e3213c0

Contents?: true

Size: 609 Bytes

Versions: 17

Compression:

Stored size: 609 Bytes

Contents

# frozen_string_literal: true

module OoxmlParser
  # Class for parsing `w:instrText` object
  class InstructionText < TextValue
    # @return [Boolean] is current object for hyperlink
    def hyperlink?
      value.include?('HYPERLINK')
    end

    # @return [Boolean] is current object for page number
    def page_number?
      value.match?(/PAGE\s+\\\*/)
    end

    # @return [Hyperlink] convert InstructionText to Hyperlink
    def to_hyperlink
      Hyperlink.new(value.sub('HYPERLINK ', '').split(' \\o ').first,
                    value.sub('HYPERLINK', '').split(' \\o ').last)
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
ooxml_parser-0.37.1 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_run/instruction_text.rb
ooxml_parser-0.37.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_run/instruction_text.rb
ooxml_parser-0.36.1 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_run/instruction_text.rb
ooxml_parser-0.36.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_run/instruction_text.rb
ooxml_parser-0.35.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_run/instruction_text.rb
ooxml_parser-0.34.2 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_run/instruction_text.rb
ooxml_parser-0.34.1 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_run/instruction_text.rb
ooxml_parser-0.34.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_run/instruction_text.rb
ooxml_parser-0.33.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_run/instruction_text.rb
ooxml_parser-0.32.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_run/instruction_text.rb
ooxml_parser-0.31.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_run/instruction_text.rb
ooxml_parser-0.30.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_run/instruction_text.rb
ooxml_parser-0.29.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_run/instruction_text.rb
ooxml_parser-0.28.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_run/instruction_text.rb
ooxml_parser-0.27.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_run/instruction_text.rb
ooxml_parser-0.26.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_run/instruction_text.rb
ooxml_parser-0.25.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_paragraph_run/instruction_text.rb