Class: OoxmlParser::TextOutline

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/text_outline.rb

Overview

Class for parsing ‘w:textOutline`

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

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

#to_hash

Constructor Details

#initialize(parent: nil) ⇒ TextOutline

Returns a new instance of TextOutline.



7
8
9
10
11
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/text_outline.rb', line 7

def initialize(parent: nil)
  @width = OoxmlSize.new(0)
  @color_scheme = :none
  @parent = parent
end

Instance Attribute Details

#color_schemeObject

Returns the value of attribute color_scheme.



5
6
7
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/text_outline.rb', line 5

def color_scheme
  @color_scheme
end

#widthObject

Returns the value of attribute width.



5
6
7
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/text_outline.rb', line 5

def width
  @width
end

Instance Method Details

#parse(node) ⇒ TextOutline

Parse TextOutline object

Parameters:

  • node (Nokogiri::XML:Element)

    node to parse

Returns:



16
17
18
19
20
21
22
23
24
25
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/text_outline.rb', line 16

def parse(node)
  node.attributes.each do |key, value|
    case key
    when 'w'
      @width = OoxmlSize.new(value.value.to_f, :emu)
    end
  end
  @color_scheme = DocxColorScheme.new(parent: self).parse(node)
  self
end