Class: OoxmlParser::Shade
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::Shade
- Defined in:
- lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/shade.rb
Overview
Class for parsing ‘w:shd` object
Instance Attribute Summary collapse
-
#color ⇒ Symbol
Color of shade.
-
#fill ⇒ Color
Fill of shade.
-
#value ⇒ Symbol
Value of shade.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#initialize(value: nil, color: nil, fill: nil, parent: nil) ⇒ Shade
constructor
A new instance of Shade.
-
#parse(node) ⇒ Shade
Parse Shade.
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(value: nil, color: nil, fill: nil, parent: nil) ⇒ Shade
Returns a new instance of Shade.
11 12 13 14 15 16 17 18 19 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/shade.rb', line 11 def initialize(value: nil, color: nil, fill: nil, parent: nil) @value = value @color = color @fill = fill @parent = parent end |
Instance Attribute Details
#color ⇒ Symbol
Returns color of shade.
7 8 9 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/shade.rb', line 7 def color @color end |
#fill ⇒ Color
Returns fill of shade.
9 10 11 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/shade.rb', line 9 def fill @fill end |
#value ⇒ Symbol
Returns value of shade.
5 6 7 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/shade.rb', line 5 def value @value end |
Instance Method Details
#parse(node) ⇒ Shade
Parse Shade
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/shade.rb', line 24 def parse(node) node.attributes.each do |key, value| case key when 'val' @value = value.value.to_sym when 'color' @color = value.value.to_sym when 'fill' @fill = Color.new(parent: self).parse_hex_string(value.value.to_s) end end self end |