Class: OoxmlParser::ThemeColor
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::ThemeColor
- Defined in:
- lib/ooxml_parser/pptx_parser/pptx_data/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) ⇒ Object
-
#initialize(parent: nil) ⇒ ThemeColor
constructor
A new instance of ThemeColor.
-
#parse(color_node) ⇒ ThemeColor
Parse ThemeColor.
Methods inherited from OOXMLDocumentObject
add_to_xmls_stack, copy_file_and_rename_to_zip, current_xml, dir, encrypted_file?, get_link_from_rels, unzip_file, #with_data?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
#initialize(parent: nil) ⇒ ThemeColor
Returns a new instance of ThemeColor.
6 7 8 9 |
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/theme_color.rb', line 6 def initialize(parent: nil) @type = '' @parent = parent end |
Instance Attribute Details
#color ⇒ Object
Returns the value of attribute color.
4 5 6 |
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/theme_color.rb', line 4 def color @color end |
#type ⇒ Object
Returns the value of attribute type.
4 5 6 |
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/theme_color.rb', line 4 def type @type end |
#value ⇒ Object
Returns the value of attribute value.
4 5 6 |
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/theme_color.rb', line 4 def value @value end |
Instance Method Details
#==(other) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/theme_color.rb', line 11 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(color_node) ⇒ ThemeColor
Parse ThemeColor
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/theme_color.rb', line 26 def parse(color_node) color_node.xpath('*').each do |color_node_child| case color_node_child.name when 'sysClr' @type = :system @value = color_node_child.attribute('val').value @color = Color.new(parent: self).parse_hex_string(color_node_child.attribute('lastClr').value.to_s) unless color_node_child.attribute('lastClr').nil? when 'srgbClr' @type = :rgb @color = Color.new(parent: self).parse_hex_string(color_node_child.attribute('val').value.to_s) end end self end |