class OoxmlParser::Borders

Borders data

Attributes

bar[RW]
between[RW]
bottom[RW]
display[RW]
inner_horizontal[RW]
inner_vertical[RW]
left[RW]
offset_from[RW]
right[RW]
top[RW]
top_left_to_bottom_right[RW]
top_right_to_bottom_left[RW]

Public Class Methods

new(parent: nil) click to toggle source
Calls superclass method OoxmlParser::OOXMLDocumentObject::new
# File lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb, line 10
def initialize(parent: nil)
  @left = BordersProperties.new
  @right = BordersProperties.new
  @top = BordersProperties.new
  @bottom = BordersProperties.new
  @between = BordersProperties.new
  @inner_horizontal = BordersProperties.new
  @inner_vertical = BordersProperties.new
  super
end

Public Instance Methods

==(other) click to toggle source

Compare this object to other @param other [Object] any other object @return [True, False] result of comparision

# File lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb, line 40
def ==(other)
  @left == other.left && @right == other.right && @top == other.top && @bottom == other.bottom if other.is_a?(Borders)
end
copy() click to toggle source

Method to copy object @return [Borders] copied object

# File lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb, line 23
def copy
  new_borders = Borders.new
  new_borders.left = @left if @left
  new_borders.right = @right if @right
  new_borders.top = @top if @top
  new_borders.bottom = @bottom if @bottom
  new_borders.inner_vertical = @inner_vertical if @inner_vertical
  new_borders.inner_horizontal = @inner_horizontal if @inner_horizontal
  new_borders.between = @between if @between
  new_borders.display = @display if @display
  new_borders.bar = @bar if @bar
  new_borders
end
each_border() { |bottom| ... } click to toggle source
# File lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb, line 44
def each_border
  yield(bottom)
  yield(inner_horizontal)
  yield(inner_vertical)
  yield(left)
  yield(right)
  yield(top)
end
each_side() { |bottom| ... } click to toggle source
# File lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb, line 53
def each_side
  yield(bottom)
  yield(left)
  yield(right)
  yield(top)
end
parse(node) click to toggle source

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

# File lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb, line 76
def parse(node)
  node.xpath('*').each do |node_child|
    case node_child.name
    when 'lnL', 'left'
      @left = TableCellLine.new(parent: self).parse(node_child)
    when 'lnR', 'right'
      @right = TableCellLine.new(parent: self).parse(node_child)
    when 'lnT', 'top'
      @top = TableCellLine.new(parent: self).parse(node_child)
    when 'lnB', 'bottom'
      @bottom = TableCellLine.new(parent: self).parse(node_child)
    when 'insideV'
      @inner_vertical = TableCellLine.new(parent: self).parse(node_child)
    when 'insideH'
      @inner_horizontal = TableCellLine.new(parent: self).parse(node_child)
    end
  end
  self
end
to_s() click to toggle source

@return [String] result of convert of object to string

# File lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb, line 61
def to_s
  "Left border: #{left}, Right: #{right}, Top: #{top}, Bottom: #{bottom}"
end
visible?() click to toggle source
# File lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb, line 65
def visible?
  visible = false
  each_side do |current_size|
    visible ||= current_size.visible?
  end
  visible
end