class OoxmlParser::ColorAlphaChannel
Class for working with AlphaChannel
Attributes
value[R]
@return [Integer] value of alpha channel
Public Instance Methods
parse(node)
click to toggle source
Parse AlphaChannel value @param node [Nokogiri::XML::Element] node to parse @return [ColorAlphaChannel] parsed object
# File lib/ooxml_parser/common_parser/common_data/colors/color_alpha_channel.rb, line 12 def parse(node) alpha_channel_node = node.xpath('a:alpha', 'xmlns:a' => 'http://schemas.openxmlformats.org/drawingml/2006/main').first alpha_channel_node = node.xpath('w14:alpha', 'xmlns:w14' => 'http://schemas.microsoft.com/office/word/2010/wordml').first if alpha_channel_node.nil? unless alpha_channel_node @value = 100.0 return self end alpha_channel_node.attributes.each do |key, value| case key when 'val' @value = (value.value.to_f / 1_000.0).round(0) end end self end