Class: OoxmlParser::Outline

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/outline.rb

Overview

Class for parsing ‘w:ln` tags

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

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

Methods included from OoxmlObjectAttributeHelper

#attribute_enabled?, #option_enabled?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

#initialize(parent: nil) ⇒ Outline

Returns a new instance of Outline.



12
13
14
15
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/outline.rb', line 12

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

Instance Attribute Details

#color_schemeDocxColorScheme (readonly)

Returns color of outline.

Returns:



10
11
12
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/outline.rb', line 10

def color_scheme
  @color_scheme
end

#widthOoxmlSize (readonly)

Returns width of outline.

Returns:



8
9
10
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/outline.rb', line 8

def width
  @width
end

Instance Method Details

#parse(node) ⇒ Outline

Parse Outline object

Parameters:

  • node (Nokogiri::XML:Element)

    node to parse

Returns:



20
21
22
23
24
25
26
27
28
29
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/outline.rb', line 20

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