class OoxmlParser::ThemeColor
Class for parsing ThemeColor
tags
Attributes
color[RW]
type[RW]
value[RW]
Public Class Methods
new(type: '', color: nil, parent: nil)
click to toggle source
Calls superclass method
OoxmlParser::OOXMLDocumentObject::new
# File lib/ooxml_parser/pptx_parser/presentation/presentation_theme/theme_color.rb, line 8 def initialize(type: '', color: nil, parent: nil) @type = type @color = color super(parent: parent) end
Public Instance Methods
==(other)
click to toggle source
Compare ThemeColor
with other object @param other [Object] object to compare @return [True, False] result of comparision
# File lib/ooxml_parser/pptx_parser/presentation/presentation_theme/theme_color.rb, line 17 def ==(other) if other.is_a?(Color) @color == other else all_instance_variables = instance_variables all_instance_variables.each do |current_attributes| return false unless instance_variable_get(current_attributes) == other.instance_variable_get(current_attributes) end true end end
parse(node)
click to toggle source
Parse ThemeColor
@param node [Nokogiri::XML::Element] node to parse @return [ThemeColor] result of parsing
# File lib/ooxml_parser/pptx_parser/presentation/presentation_theme/theme_color.rb, line 32 def parse(node) node.xpath('*').each do |node_child| case node_child.name when 'sysClr' @type = :system @value = node_child.attribute('val').value @color = Color.new(parent: self).parse_hex_string(node_child.attribute('lastClr').value.to_s) unless node_child.attribute('lastClr').nil? when 'srgbClr' @type = :rgb @color = Color.new(parent: self).parse_hex_string(node_child.attribute('val').value.to_s) end end self end