Class: OoxmlParser::Tab

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/tabs/tab.rb

Overview

Class for storing ‘w:tab`, `a:tab` data

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

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 Attribute Details

#leaderSymbol (readonly)

Returns Specifies the leader symbol of tab.

Returns:

  • (Symbol)

    Specifies the leader symbol of tab



9
10
11
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/tabs/tab.rb', line 9

def leader
  @leader
end

#positionOOxmlSize

Returns Specifies the position of the tab stop.

Returns:

  • (OOxmlSize)

    Specifies the position of the tab stop.



11
12
13
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/tabs/tab.rb', line 11

def position
  @position
end

#valueSymbol Also known as: align

Returns Specifies the style of the tab.

Returns:

  • (Symbol)

    Specifies the style of the tab.



7
8
9
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/tabs/tab.rb', line 7

def value
  @value
end

Instance Method Details

#parse(node) ⇒ ParagraphTab

Parse ParagraphTab object

Parameters:

  • node (Nokogiri::XML:Element)

    node to parse

Returns:

  • (ParagraphTab)

    result of parsing



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/tabs/tab.rb', line 18

def parse(node)
  node.attributes.each do |key, value|
    case key
    when 'algn', 'val'
      @value = value_to_symbol(value)
    when 'leader'
      @leader = value_to_symbol(value)
    when 'pos'
      @position = OoxmlSize.new(value.value.to_f, position_unit(node))
    end
  end
  self
end