Class: OoxmlParser::DocxShapeLine
- Inherits:
-
Object
- Object
- 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.
-
#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.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ DocxShapeLine
constructor
A new instance of DocxShapeLine.
- #nil? ⇒ Boolean
- #stroke_size ⇒ Object
Constructor Details
#initialize ⇒ DocxShapeLine
Returns a new instance of DocxShapeLine.
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 initialize @width = 0 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 |
#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 |
Class Method Details
.parse(shape_line_node) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb', line 26 def self.parse(shape_line_node) shape_line = DocxShapeLine.new shape_line.width = (shape_line_node.attribute('w').value.to_f / 12_699.3).round(2) unless shape_line_node.attribute('w').nil? unless shape_line_node.attribute('cap').nil? case shape_line_node.attribute('cap').value when 'rnd' shape_line.cap = :round when 'sq' shape_line.cap = :square when 'flat' shape_line.cap = :flat end end shape_line_node.xpath('*').each do |shape_line_node_child| case shape_line_node_child.name when 'solidFill' shape_line.color_scheme = DocxColorScheme.parse(shape_line_node_child) when 'noFill' shape_line.width = 0 when 'headEnd' shape_line.head_end = LineEnd.parse(shape_line_node_child) when 'tailEnd' shape_line.tail_end = LineEnd.parse(shape_line_node_child) end end shape_line end |
Instance Method Details
#nil? ⇒ Boolean
22 23 24 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb', line 22 def nil? stroke_size == 0 && cap.nil? end |
#stroke_size ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb', line 14 def stroke_size if @color_scheme.nil? || @color_scheme.color == :none 0 else @width end end |