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
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.
- #nil? ⇒ Boolean
-
#parse(node) ⇒ DocxShapeLine
Parse DocxShapeLine object.
- #stroke_size ⇒ Object
Methods inherited from OOXMLDocumentObject
#==, add_to_xmls_stack, copy_file_and_rename_to_zip, current_xml, dir, encrypted_file?, get_link_from_rels, unzip_file, #with_data?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
#initialize(parent: nil) ⇒ DocxShapeLine
Returns a new instance of DocxShapeLine.
12 13 14 15 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb', line 12 def initialize(parent: nil) @width = OoxmlSize.new(0) @parent = parent end |
Instance Attribute Details
#cap ⇒ Object
Returns the value of attribute cap.
6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb', line 6 def cap @cap end |
#color_scheme ⇒ Object Also known as: color
Returns the value of attribute color_scheme.
6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb', line 6 def color_scheme @color_scheme end |
#dash ⇒ ValuedChild
Returns dash properties.
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 dash @dash end |
#fill ⇒ Object
Returns the value of attribute fill.
6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb', line 6 def fill @fill end |
#head_end ⇒ Object
Returns the value of attribute head_end.
6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb', line 6 def head_end @head_end end |
#tail_end ⇒ Object
Returns the value of attribute tail_end.
6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb', line 6 def tail_end @tail_end end |
#width ⇒ Object
Returns the value of attribute width.
6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb', line 6 def width @width end |
Instance Method Details
#nil? ⇒ Boolean
25 26 27 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb', line 25 def nil? stroke_size.zero? && cap.nil? end |
#parse(node) ⇒ DocxShapeLine
Parse DocxShapeLine object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb', line 32 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 ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb', line 17 def stroke_size if @color_scheme.nil? || @color_scheme.color == :none 0 else @width end end |