Class: OoxmlParser::Fill
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::Fill
- Defined in:
- lib/ooxml_parser/xlsx_parser/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 ⇒ OoxmlColor
Convert Fill to color.
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
#color2 ⇒ Color (readonly)
Returns second color.
10 11 12 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/style_sheet/fills/fill.rb', line 10 def color2 @color2 end |
#file ⇒ FileReference (readonly)
Returns file of fill.
14 15 16 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/style_sheet/fills/fill.rb', line 14 def file @file end |
#id ⇒ String (readonly)
Returns id of file.
12 13 14 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/style_sheet/fills/fill.rb', line 12 def id @id end |
#pattern_fill ⇒ PatternFill
Returns pattern fill.
8 9 10 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/style_sheet/fills/fill.rb', line 8 def pattern_fill @pattern_fill end |
#value ⇒ Symbol (readonly)
Returns value.
16 17 18 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/style_sheet/fills/fill.rb', line 16 def value @value end |
Instance Method Details
#parse(node) ⇒ Fill
Parse Fill data
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/style_sheet/fills/fill.rb', line 21 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 ⇒ OoxmlColor
Convert Fill to color
45 46 47 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/style_sheet/fills/fill.rb', line 45 def to_color pattern_fill.foreground_color end |