class OoxmlParser::DocxShapeLine
Docx Shape
Line
Attributes
cap[RW]
color[RW]
color_scheme[RW]
dash[RW]
@return [ValuedChild] dash properties
fill[RW]
head_end[RW]
tail_end[RW]
width[RW]
Public Class Methods
new(parent: nil)
click to toggle source
Calls superclass method
# File lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb, line 14 def initialize(parent: nil) @width = OoxmlSize.new(0) super end
Public Instance Methods
invisible?()
click to toggle source
@return [True, False] is line invisible
# File lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb, line 29 def invisible? stroke_size.zero? && cap.nil? end
parse(node)
click to toggle source
Parse DocxShapeLine
object @param node [Nokogiri::XML:Element] node to parse @return [DocxShapeLine] result of parsing
# File lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb, line 36 def parse(node) node.attributes.each do |key, value| case key when 'w' @width = OoxmlSize.new(value.value.to_f, :emu) when 'cap' @cap = value_to_symbol(value) end end node.xpath('*').each do |node_child| case node_child.name when 'solidFill' @color_scheme = DocxColorScheme.new(parent: self).parse(node_child) when 'noFill' @width = OoxmlSize.new(0) when 'headEnd' @head_end = LineEnd.new(parent: self).parse(node_child) when 'tailEnd' @tail_end = LineEnd.new(parent: self).parse(node_child) when 'prstDash' @dash = ValuedChild.new(:symbol, parent: self).parse(node_child) end end self end
stroke_size()
click to toggle source
@return [Integer] stroke size of object
# File lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb, line 20 def stroke_size if @color_scheme.nil? || @color_scheme.color == :none 0 else @width end end