class OoxmlParser::Fills

Parsing ‘fonts` tag

Attributes

fills_array[RW]

@return [Array, Fill] array of fills

Public Class Methods

new(parent: nil) click to toggle source
Calls superclass method OoxmlParser::OOXMLDocumentObject::new
# File lib/ooxml_parser/xlsx_parser/workbook/style_sheet/fills.rb, line 10
def initialize(parent: nil)
  @fills_array = []
  super
end

Public Instance Methods

[](key) click to toggle source

@return [Array, Fill] accessor

# File lib/ooxml_parser/xlsx_parser/workbook/style_sheet/fills.rb, line 16
def [](key)
  @fills_array[key]
end
parse(node) click to toggle source

Parse Fills data @param [Nokogiri::XML:Element] node with Fills data @return [Fills] value of Fills data

# File lib/ooxml_parser/xlsx_parser/workbook/style_sheet/fills.rb, line 23
def parse(node)
  node.attributes.each do |key, value|
    case key
    when 'count'
      @count = value.value.to_i
    end
  end

  node.xpath('*').each do |node_child|
    case node_child.name
    when 'fill'
      @fills_array << Fill.new(parent: self).parse(node_child)
    end
  end
  self
end