Class: OoxmlParser::Fill
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::Fill
- Defined in:
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill.rb
Overview
Parsing ‘fill` tag
Instance Attribute Summary collapse
-
#color2 ⇒ Color
readonly
Second color.
-
#file ⇒ FileReference
readonly
File of fill.
-
#id ⇒ String
readonly
Id of file.
-
#pattern_fill ⇒ PatternFill
Pattern fill.
-
#value ⇒ Symbol
readonly
Value.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#parse(node) ⇒ Fill
Parse Fill data.
- #to_color ⇒ Object
Methods inherited from OOXMLDocumentObject
#==, add_to_xmls_stack, copy_file_and_rename_to_zip, current_xml, dir, encrypted_file?, get_link_from_rels, #initialize, unzip_file, #with_data?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
This class inherits a constructor from OoxmlParser::OOXMLDocumentObject
Instance Attribute Details
#color2 ⇒ Color (readonly)
Returns second color.
8 9 10 |
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill.rb', line 8 def color2 @color2 end |
#file ⇒ FileReference (readonly)
Returns file of fill.
12 13 14 |
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill.rb', line 12 def file @file end |
#id ⇒ String (readonly)
Returns id of file.
10 11 12 |
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill.rb', line 10 def id @id end |
#pattern_fill ⇒ PatternFill
Returns pattern fill.
6 7 8 |
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill.rb', line 6 def pattern_fill @pattern_fill end |
#value ⇒ Symbol (readonly)
Returns value.
14 15 16 |
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill.rb', line 14 def value @value end |
Instance Method Details
#parse(node) ⇒ Fill
Parse Fill data
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill.rb', line 19 def parse(node) node.attributes.each do |key, value| case key when 'color2' @color2 = Color.new(parent: self).parse_hex_string(value.value.split(' ').first.delete('#')) when 'id' @id = value.value.to_s @file = FileReference.new(parent: self).parse(node) when 'type' @type = value_to_symbol(value) end end node.xpath('*').each do |node_child| case node_child.name when 'patternFill' @pattern_fill = PatternFill.new(parent: self).parse(node_child) end end self end |
#to_color ⇒ Object
41 42 43 |
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill.rb', line 41 def to_color pattern_fill.foreground_color end |