Sha256: fc93dffe9386714cf254d884c0effaf97fc9a98a977b9ab4b6aa09e87070f8e4
Contents?: true
Size: 1.78 KB
Versions: 32
Compression:
Stored size: 1.78 KB
Contents
# frozen_string_literal: true module OoxmlParser # Border Properties Data class BordersProperties < OOXMLDocumentObject attr_accessor :color, :space, :val, :shadow, :frame, :side # @return [OoxmlSize] size of border attr_reader :size def initialize(color = :auto, size = 0, val = :none, space = 0, parent: nil) @color = color @size = size @val = val @space = space super(parent: parent) end # @return [OoxmlSize] alias for sz def sz size end extend Gem::Deprecate deprecate :sz, 'size', 2020, 1 def nil? size.zero? && val == :none end # @return [String] result of convert of object to string def to_s return '' if nil? "borders color: #{@color}, size: #{size}, space: #{@space}, value: #{@val}" end # Method to copy object # @return [BordersProperties] copied object def copy BordersProperties.new(@color, size, @val, @space) end def visible? return false if nil? val != 'none' end # Parse BordersProperties # @param [Nokogiri::XML:Element] node with BordersProperties # @return [BordersProperties] value of BordersProperties def parse(node) return nil if node.attribute('val').value == 'nil' node.attributes.each do |key, value| case key when 'val' @val = value.value.to_sym when 'sz' @size = OoxmlSize.new(value.value.to_f, :one_eighth_point) when 'space' @space = OoxmlSize.new(value.value.to_f, :point) when 'color' @color = value.value.to_s @color = Color.new(parent: self).parse_hex_string(@color) if @color != 'auto' when 'shadow' @shadow = value.value end end self end end end
Version data entries
32 entries across 32 versions & 1 rubygems