class OoxmlParser::Tab

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

Attributes

align[RW]

@return [Symbol] Specifies the style of the tab.

leader[R]

@return [Symbol] Specifies the leader symbol of tab

position[RW]

@return [OOxmlSize] Specifies the position of the tab stop.

value[RW]

@return [Symbol] Specifies the style of the tab.

Public Instance Methods

parse(node) click to toggle source

Parse ParagraphTab object @param node [Nokogiri::XML:Element] node to parse @return [ParagraphTab] result of parsing

# 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

Private Instance Methods

position_unit(node) click to toggle source

@param node [Nokogiri::XML:Element] node to determine size @return [Symbol] type of size unit

# File lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/tabs/tab.rb, line 36
def position_unit(node)
  return :emu if node.namespace.prefix == 'a'

  :dxa
end