Class: OoxmlParser::ThemeColor
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::ThemeColor
- Defined in:
- lib/ooxml_parser/pptx_parser/presentation/presentation_theme/theme_color.rb
Overview
Class for parsing ThemeColor tags
Instance Attribute Summary collapse
-
#color ⇒ Object
Returns the value of attribute color.
-
#type ⇒ Object
Returns the value of attribute type.
-
#value ⇒ Object
Returns the value of attribute value.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#==(other) ⇒ True, False
Compare ThemeColor with other object.
-
#initialize(type: '', color: nil, parent: nil) ⇒ ThemeColor
constructor
A new instance of ThemeColor.
-
#parse(node) ⇒ ThemeColor
Parse ThemeColor.
Methods inherited from OOXMLDocumentObject
#boolean_attribute_value, #parse_xml, #with_data?
Methods included from OoxmlObjectAttributeHelper
#attribute_enabled?, #option_enabled?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
#initialize(type: '', color: nil, parent: nil) ⇒ ThemeColor
Returns a new instance of ThemeColor.
8 9 10 11 12 |
# 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 |
Instance Attribute Details
#color ⇒ Object
Returns the value of attribute color.
6 7 8 |
# File 'lib/ooxml_parser/pptx_parser/presentation/presentation_theme/theme_color.rb', line 6 def color @color end |
#type ⇒ Object
Returns the value of attribute type.
6 7 8 |
# File 'lib/ooxml_parser/pptx_parser/presentation/presentation_theme/theme_color.rb', line 6 def type @type end |
#value ⇒ Object
Returns the value of attribute value.
6 7 8 |
# File 'lib/ooxml_parser/pptx_parser/presentation/presentation_theme/theme_color.rb', line 6 def value @value end |
Instance Method Details
#==(other) ⇒ True, False
Compare ThemeColor with other object
17 18 19 20 21 22 23 24 25 26 27 |
# 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) ⇒ ThemeColor
Parse ThemeColor
32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# 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 |