Class: OoxmlParser::DocxColorScheme
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::DocxColorScheme
- Defined in:
- lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_color_scheme.rb
Overview
DOCX Color Scheme
Instance Attribute Summary collapse
-
#color ⇒ Object
Returns the value of attribute color.
-
#type ⇒ Object
Returns the value of attribute type.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#initialize(parent: nil) ⇒ DocxColorScheme
constructor
A new instance of DocxColorScheme.
-
#parse(node) ⇒ DocxColorScheme
Parse DocxColorScheme object.
- #to_s ⇒ Object
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) ⇒ DocxColorScheme
Returns a new instance of DocxColorScheme.
6 7 8 9 10 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_color_scheme.rb', line 6 def initialize(parent: nil) @color = Color.new @type = :unknown @parent = parent end |
Instance Attribute Details
#color ⇒ Object
Returns the value of attribute color.
4 5 6 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_color_scheme.rb', line 4 def color @color end |
#type ⇒ Object
Returns the value of attribute type.
4 5 6 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_color_scheme.rb', line 4 def type @type end |
Instance Method Details
#parse(node) ⇒ DocxColorScheme
Parse DocxColorScheme object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_color_scheme.rb', line 15 def parse(node) node.xpath('*').each do |node_child| case node_child.name when 'solidFill' @type = :solid @color = Color.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.parse_scheme_color(node_child) end end self end |
#to_s ⇒ Object
36 37 38 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_color_scheme.rb', line 36 def to_s "Color: #{@color}, type: #{type}" end |