class OoxmlParser::GradientColor

Class for parsing `gradFill` tags

Attributes

gradient_stops[RW]
linear_gradient[RW]

@return [LinearGradient] content of Linear Gradient

path[RW]

Public Class Methods

new(parent: nil) click to toggle source
Calls superclass method
# File lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color.rb, line 12
def initialize(parent: nil)
  @gradient_stops = []
  super
end

Public Instance Methods

parse(node) click to toggle source

Parse GradientColor object @param node [Nokogiri::XML:Element] node to parse @return [GradientColor] result of parsing

# 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