Class: OoxmlParser::GradientColor
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::GradientColor
- Defined in:
- lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color.rb
Overview
Class for parsing ‘gradFill` tags
Instance Attribute Summary collapse
-
#gradient_stops ⇒ Object
Returns the value of attribute gradient_stops.
-
#linear_gradient ⇒ LinearGradient
Content of Linear Gradient.
-
#path ⇒ Object
Returns the value of attribute path.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#initialize(parent: nil) ⇒ GradientColor
constructor
A new instance of GradientColor.
-
#parse(node) ⇒ GradientColor
Parse GradientColor 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) ⇒ GradientColor
Returns a new instance of GradientColor.
12 13 14 15 |
# File 'lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color.rb', line 12 def initialize(parent: nil) @gradient_stops = [] super end |
Instance Attribute Details
#gradient_stops ⇒ Object
Returns the value of attribute gradient_stops.
8 9 10 |
# File 'lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color.rb', line 8 def gradient_stops @gradient_stops end |
#linear_gradient ⇒ LinearGradient
Returns content of Linear Gradient.
10 11 12 |
# File 'lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color.rb', line 10 def linear_gradient @linear_gradient end |
#path ⇒ Object
Returns the value of attribute path.
8 9 10 |
# File 'lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color.rb', line 8 def path @path end |
Instance Method Details
#parse(node) ⇒ GradientColor
Parse GradientColor object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color.rb', line 20 def parse(node) node.xpath('*').each do |node_child| case node_child.name when 'gsLst' node_child.xpath('*').each do |gradient_stop_node| @gradient_stops << GradientStop.new(parent: self).parse(gradient_stop_node) end when 'path' @path = node_child.attribute('path').value.to_sym when 'lin' @linear_gradient = LinearGradient.new(parent: self).parse(node_child) end end self end |