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
Constant Summary
Constants inherited from OOXMLDocumentObject
OOXMLDocumentObject::DEFAULT_DIRECTORY_FOR_MEDIA
Instance Attribute Summary collapse
-
#color ⇒ Object
Returns the value of attribute color.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ DocxColorScheme
constructor
A new instance of DocxColorScheme.
- #to_s ⇒ Object
Methods inherited from OOXMLDocumentObject
#==, add_to_xmls_stack, copy_file_and_rename_to_zip, copy_media_file, current_xml, dir, encrypted_file?, get_link_from_rels, media_folder, option_enabled?, unzip_file
Constructor Details
#initialize ⇒ DocxColorScheme
Returns a new instance of DocxColorScheme.
6 7 8 9 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_color_scheme.rb', line 6 def initialize @color = Color.new @type = :unknown 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 |
Class Method Details
.parse(color_scheme_node) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_color_scheme.rb', line 11 def self.parse(color_scheme_node) color_scheme = DocxColorScheme.new color_scheme_node.xpath('*').each do |color_scheme_node_child| case color_scheme_node_child.name when 'solidFill' color_scheme.type = :solid color_scheme.color = Color.parse_color_model(color_scheme_node_child) when 'gradFill' color_scheme.type = :gradient color_scheme.color = GradientColor.parse(color_scheme_node_child) when 'noFill' color_scheme.color = :none color_scheme.type = :none when 'srgbClr' color_scheme.color = Color.from_int16(color_scheme_node_child.attribute('val').value) when 'schemeClr' color_scheme.color = Color.parse_scheme_color(color_scheme_node_child) end end color_scheme end |
Instance Method Details
#to_s ⇒ Object
33 34 35 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_color_scheme.rb', line 33 def to_s "Color: #{@color}, type: #{type}" end |