class OoxmlParser::TableCellLine

Class for parsing Table Cell Lines

Attributes

align[RW]
cap_type[RW]
compound_line_type[RW]
dash[RW]
fill[RW]
head_end[RW]
line_join[RW]
tail_end[RW]
width[RW]

Public Class Methods

new(fill = nil, line_join = nil, parent: nil) click to toggle source
Calls superclass method OoxmlParser::OOXMLDocumentObject::new
# File lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line.rb, line 9
def initialize(fill = nil, line_join = nil, parent: nil)
  @fill = fill
  @line_join = line_join
  super(parent: parent)
end

Public Instance Methods

parse(node) click to toggle source

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

# File lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line.rb, line 18
def parse(node)
  @fill = PresentationFill.new(parent: self).parse(node)
  @line_join = LineJoin.new(parent: self).parse(node)
  node.attributes.each do |key, value|
    case key
    when 'w'
      @width = OoxmlSize.new(value.value.to_f, :emu)
    when 'algn'
      @align = value_to_symbol(value)
    end
  end

  node.xpath('*').each do |node_child|
    case node_child.name
    when 'headEnd'
      @head_end = LineEnd.new(parent: self).parse(node_child)
    when 'tailEnd'
      @tail_end = LineEnd.new(parent: self).parse(node_child)
    when 'ln'
      return TableCellLine.new(parent: self).parse(node_child)
    end
  end
  self
end