class OoxmlParser::Shade
Class for parsing ‘w:shd` object
Attributes
color[RW]
@return [Symbol] color of shade
fill[RW]
@return [Color] fill of shade
value[RW]
@return [Symbol] value of shade
Public Class Methods
new(value: nil, color: nil, fill: nil, parent: nil)
click to toggle source
Calls superclass method
OoxmlParser::OOXMLDocumentObject::new
# 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
Public Instance Methods
parse(node)
click to toggle source
Parse Shade
@param [Nokogiri::XML:Node] node with Shade
@return [Shade] result of parsing
# 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
to_background_color()
click to toggle source
Helper method to get background color @return [OoxmlParser::Color]
# 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
to_s()
click to toggle source
@return [String] text representation
# 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