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 ⇒ String
Result of convert of object to string.
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(parent: nil) ⇒ DocxColorScheme
Returns a new instance of DocxColorScheme.
8 9 10 11 12 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_color_scheme.rb', line 8 def initialize(parent: nil) @color = Color.new @type = :unknown super end |
Instance Attribute Details
#color ⇒ Object
Returns the value of attribute color.
6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_color_scheme.rb', line 6 def color @color end |
#type ⇒ Object
Returns the value of attribute type.
6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_color_scheme.rb', line 6 def type @type end |
Instance Method Details
#parse(node) ⇒ DocxColorScheme
Parse DocxColorScheme object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_color_scheme.rb', line 17 def parse(node) node.xpath('*').each do |node_child| case node_child.name when 'solidFill' @type = :solid @color = Color.new(parent: self).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.new(parent: self).parse_scheme_color(node_child) end end self end |
#to_s ⇒ String
Returns result of convert of object to string.
39 40 41 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_color_scheme.rb', line 39 def to_s "Color: #{@color}, type: #{type}" end |