Class: OoxmlParser::DocxShapeLine
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::DocxShapeLine
- Defined in:
- lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb
Overview
Docx Shape Line
Instance Attribute Summary collapse
-
#cap ⇒ Object
Returns the value of attribute cap.
-
#color_scheme ⇒ Object
(also: #color)
Returns the value of attribute color_scheme.
-
#dash ⇒ ValuedChild
Dash properties.
-
#fill ⇒ Object
Returns the value of attribute fill.
-
#head_end ⇒ Object
Returns the value of attribute head_end.
-
#tail_end ⇒ Object
Returns the value of attribute tail_end.
-
#width ⇒ Object
Returns the value of attribute width.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#initialize(parent: nil) ⇒ DocxShapeLine
constructor
A new instance of DocxShapeLine.
-
#invisible? ⇒ True, False
Is line invisible.
-
#parse(node) ⇒ DocxShapeLine
Parse DocxShapeLine object.
-
#stroke_size ⇒ Integer
Stroke size of object.
Methods inherited from OOXMLDocumentObject
#==, #boolean_attribute_value, #parse_xml, #with_data?
Methods included from OoxmlObjectAttributeHelper
#attribute_enabled?, #option_enabled?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
#initialize(parent: nil) ⇒ DocxShapeLine
Returns a new instance of DocxShapeLine.
14 15 16 17 |
# 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 |
Instance Attribute Details
#cap ⇒ Object
Returns the value of attribute cap.
8 9 10 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb', line 8 def cap @cap end |
#color_scheme ⇒ Object Also known as: color
Returns the value of attribute color_scheme.
8 9 10 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb', line 8 def color_scheme @color_scheme end |
#dash ⇒ ValuedChild
Returns dash properties.
10 11 12 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb', line 10 def dash @dash end |
#fill ⇒ Object
Returns the value of attribute fill.
8 9 10 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb', line 8 def fill @fill end |
#head_end ⇒ Object
Returns the value of attribute head_end.
8 9 10 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb', line 8 def head_end @head_end end |
#tail_end ⇒ Object
Returns the value of attribute tail_end.
8 9 10 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb', line 8 def tail_end @tail_end end |
#width ⇒ Object
Returns the value of attribute width.
8 9 10 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb', line 8 def width @width end |
Instance Method Details
#invisible? ⇒ True, False
Returns is line invisible.
29 30 31 |
# 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) ⇒ DocxShapeLine
Parse DocxShapeLine object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# 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 ⇒ Integer
Returns stroke size of object.
20 21 22 23 24 25 26 |
# 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 |