Sha256: 12858556756d1d9744dbdbf8a4bf8f49f28a4cae74524ca6e4c5d199f343996d

Contents?: true

Size: 1.16 KB

Versions: 8

Compression:

Stored size: 1.16 KB

Contents

# frozen_string_literal: true

require_relative 'filter_column/custom_filters'
module OoxmlParser
  # Class for `filterColumn` data
  # The filterColumn collection identifies a particular
  # column in the AutoFilter range and specifies
  # filter information that has been applied to this column.
  class FilterColumn < OOXMLDocumentObject
    # @return [True, False] Flag indicating whether the filter button is visible.
    attr_accessor :show_button
    # @return [CustomFilters] list of filters
    attr_reader :custom_filters

    def initialize(parent: nil)
      @show_button = true
      @parent = parent
    end

    # Parse FilterColumn data
    # @param [Nokogiri::XML:Element] node with FilterColumn data
    # @return [FilterColumn] value of FilterColumn data
    def parse(node)
      node.attributes.each do |key, value|
        case key
        when 'showButton'
          @show_button = attribute_enabled?(value)
        end
      end

      node.xpath('*').each do |node_child|
        case node_child.name
        when 'customFilters'
          @custom_filters = CustomFilters.new(parent: self).parse(node_child)
        end
      end
      self
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ooxml_parser-0.8.1 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter/filter_column.rb
ooxml_parser-0.8.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter/filter_column.rb
ooxml_parser-0.7.2 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter/filter_column.rb
ooxml_parser-0.7.1 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter/filter_column.rb
ooxml_parser-0.7.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter/filter_column.rb
ooxml_parser-0.6.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter/filter_column.rb
ooxml_parser-0.5.1 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter/filter_column.rb
ooxml_parser-0.5.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter/filter_column.rb