Sha256: e464015284ce1ecca437b9f4175dd1fd7d09dc11a37d963c13061be88d3c021b
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
require_relative 'gradient_color/gradient_stop' require_relative 'gradient_color/linear_gradient' module OoxmlParser class GradientColor attr_accessor :gradient_stops, :path def initialize(colors = []) @gradient_stops = colors end def self.parse(gradient_fill_node) gradient_color = GradientColor.new gradient_fill_node.xpath('*').each do |gradient_fill_node_child| case gradient_fill_node_child.name when 'gsLst' begin gradient_fill_node_child.xpath('//a:gs') namespace = 'a' rescue Nokogiri::XML::XPath::SyntaxError namespace = 'w14' end gradient_fill_node_child.xpath("#{namespace}:gs").each do |gradient_stop_node| gradient_color.gradient_stops << GradientStop.parse(gradient_stop_node) end when 'path' gradient_color.path = gradient_fill_node_child.attribute('path').value.to_sym when 'lin' gradient_color.path = LinearGradient.parse(gradient_fill_node_child) end end gradient_color end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ooxml_parser-0.1.2 | lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color.rb |