class OoxmlParser::DocxColorScheme

DOCX Color Scheme

Attributes

color[RW]
type[RW]

Public Class Methods

new(parent: nil) click to toggle source
Calls superclass method
# File lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_color_scheme.rb, line 8
def initialize(parent: nil)
  @color = Color.new
  @type = :unknown
  super
end

Public Instance Methods

parse(node) click to toggle source

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

# File lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_color_scheme.rb, line 17
def parse(node)
  node.xpath('*').each do |node_child|
    case node_child.name
    when 'solidFill'
      @type = :solid
      @color = Color.new(parent: self).parse_color_model(node_child)
    when 'gradFill'
      @type = :gradient
      @color = GradientColor.new(parent: self).parse(node_child)
    when 'noFill'
      @color = :none
      @type = :none
    when 'srgbClr'
      @color = Color.new(parent: self).parse_hex_string(node_child.attribute('val').value)
    when 'schemeClr'
      @color = Color.new(parent: self).parse_scheme_color(node_child)
    end
  end
  self
end
to_s() click to toggle source

@return [String] result of convert of object to string

# File lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_color_scheme.rb, line 39
def to_s
  "Color: #{@color}, type: #{type}"
end