Class: OoxmlParser::DocxGradientColor
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::DocxGradientColor
- Defined in:
- lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/gradient_color/docx_gradient_color.rb
Constant Summary
Constants inherited from OOXMLDocumentObject
OOXMLDocumentObject::DEFAULT_DIRECTORY_FOR_MEDIA
Instance Attribute Summary collapse
-
#gradient_stops ⇒ Object
Returns the value of attribute gradient_stops.
-
#path ⇒ Object
Returns the value of attribute path.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(colors = []) ⇒ DocxGradientColor
constructor
A new instance of DocxGradientColor.
Methods inherited from OOXMLDocumentObject
#==, add_to_xmls_stack, copy_file_and_rename_to_zip, copy_media_file, current_xml, dir, encrypted_file?, get_link_from_rels, media_folder, option_enabled?, unzip_file
Constructor Details
#initialize(colors = []) ⇒ DocxGradientColor
Returns a new instance of DocxGradientColor.
7 8 9 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/gradient_color/docx_gradient_color.rb', line 7 def initialize(colors = []) @gradient_stops = colors end |
Instance Attribute Details
#gradient_stops ⇒ Object
Returns the value of attribute gradient_stops.
5 6 7 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/gradient_color/docx_gradient_color.rb', line 5 def gradient_stops @gradient_stops end |
#path ⇒ Object
Returns the value of attribute path.
5 6 7 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/gradient_color/docx_gradient_color.rb', line 5 def path @path end |
#type ⇒ Object
Returns the value of attribute type.
5 6 7 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/gradient_color/docx_gradient_color.rb', line 5 def type @type end |
Class Method Details
.parse(gradient_fill_node) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/gradient_color/docx_gradient_color.rb', line 11 def self.parse(gradient_fill_node) gradient_color = DocxGradientColor.new gradient_fill_node.xpath('*').each do |grad_fill_color_child| case grad_fill_color_child.name when 'gsLst' grad_fill_color_child.xpath('a:gs', 'xmlns:a' => 'http://schemas.openxmlformats.org/drawingml/2006/main').each do |gradient_single_color_node| # gradient_single_color_node.xpath('*').each do |gradient_color_node| single_gradient_color = DocxSingleGradientColor.new single_gradient_color.color = Color.parse_color_model(gradient_single_color_node) single_gradient_color.position = gradient_single_color_node.attribute('pos').value.to_f / 1_000.0 gradient_color.gradient_stops << single_gradient_color end when 'path' gradient_color.path = grad_fill_color_child.attribute('path').value.to_sym end end gradient_color end |