Class: OoxmlParser::GradientColor
- Inherits:
-
Object
- Object
- 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.
Instance Method Summary collapse
-
#initialize(parent: nil) ⇒ GradientColor
constructor
A new instance of GradientColor.
-
#parse(node) ⇒ GradientColor
Parse GradientColor object.
Constructor Details
#initialize(parent: nil) ⇒ GradientColor
Returns a new instance of GradientColor.
10 11 12 13 |
# File 'lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color.rb', line 10 def initialize(parent: nil) @gradient_stops = [] @parent = parent end |
Instance Attribute Details
#gradient_stops ⇒ Object
Returns the value of attribute gradient_stops.
6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color.rb', line 6 def gradient_stops @gradient_stops end |
#linear_gradient ⇒ LinearGradient
Returns content of Linear Gradient.
8 9 10 |
# File 'lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color.rb', line 8 def linear_gradient @linear_gradient end |
#path ⇒ Object
Returns the value of attribute path.
6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color.rb', line 6 def path @path end |
Instance Method Details
#parse(node) ⇒ GradientColor
Parse GradientColor object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color.rb', line 18 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 |