Class: OoxmlParser::DocxColor
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::DocxColor
- Defined in:
- lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_color.rb
Overview
Color inside DOCX
Instance Attribute Summary collapse
-
#alpha ⇒ Object
Returns the value of attribute alpha.
-
#stretching_type ⇒ Object
Returns the value of attribute stretching_type.
-
#type ⇒ Object
Returns the value of attribute type.
-
#value ⇒ Object
Returns the value of attribute value.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#parse(node) ⇒ DocxColor
Parse DocxColor object.
Methods inherited from OOXMLDocumentObject
#==, #boolean_attribute_value, #initialize, #parse_xml, #with_data?
Methods included from OoxmlObjectAttributeHelper
#attribute_enabled?, #option_enabled?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
This class inherits a constructor from OoxmlParser::OOXMLDocumentObject
Instance Attribute Details
#alpha ⇒ Object
Returns the value of attribute alpha.
7 8 9 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_color.rb', line 7 def alpha @alpha end |
#stretching_type ⇒ Object
Returns the value of attribute stretching_type.
7 8 9 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_color.rb', line 7 def stretching_type @stretching_type end |
#type ⇒ Object
Returns the value of attribute type.
7 8 9 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_color.rb', line 7 def type @type end |
#value ⇒ Object
Returns the value of attribute value.
7 8 9 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_color.rb', line 7 def value @value end |
Instance Method Details
#parse(node) ⇒ DocxColor
Parse DocxColor object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_color.rb', line 12 def parse(node) node.xpath('*').each do |node_child| case node_child.name when 'blipFill' @type = :picture @value = DocxBlip.new(parent: self).parse(node_child) node_child.xpath('*').each do |fill_type_node_child| case fill_type_node_child.name when 'tile' @stretching_type = :tile when 'stretch' @stretching_type = :stretch when 'blip' fill_type_node_child.xpath('alphaModFix').each { |alpha_node| @alpha = alpha_node.attribute('amt').value.to_i / 1_000.0 } end end when 'solidFill' @type = :solid @value = Color.new(parent: self).parse_color_model(node_child) when 'gradFill' @type = :gradient @value = GradientColor.new(parent: self).parse(node_child) when 'pattFill' @type = :pattern @value = DocxPatternFill.new(parent: self).parse(node_child) end end self end |