class OoxmlParser::Shade
Class for parsing ‘w:shd` object
Attributes
@return [Symbol] color of shade
@return [Color] fill of shade
@return [Symbol] value of shade
Public Class Methods
Source
# File lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/shade.rb, line 13 def initialize(value: nil, color: nil, fill: nil, parent: nil) @value = value @color = color @fill = fill super(parent: parent) end
Calls superclass method
OoxmlParser::OOXMLDocumentObject::new
Public Instance Methods
Source
# File lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/shade.rb, line 33 def parse(node) node.attributes.each do |key, value| case key when 'val' @value = value.value.to_sym when 'color' @color = value.value.to_sym when 'fill' @fill = Color.new(parent: self).parse_hex_string(value.value.to_s) end end self end
Parse Shade
@param [Nokogiri::XML:Node] node with Shade
@return [Shade] result of parsing
Source
# File lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/shade.rb, line 49 def to_background_color return nil unless fill background_color = fill background_color.set_style(value) if value background_color end
Helper method to get background color @return [OoxmlParser::Color]
Source
# File lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/shade.rb, line 24 def to_s "Value: `#{value}`, " \ "Color: `#{color}`, " \ "Fill: `#{fill}`" end
@return [String] text representation