Method: Axlsx::SortCondition#initialize

Defined in:
lib/axlsx/workbook/worksheet/auto_filter/sort_condition.rb

#initialize(column_index:, order:, custom_list:) ⇒ SortCondition

Creates a new SortCondition object

Parameters:

  • column_index (Integer)

    Zero-based index indicating the AutoFilter column to which the sorting should be applied to

  • order (Symbol)

    The order the column should be sorted on, can only be :asc or :desc

  • custom_list (Array)

    An array containg a custom sorting list in order.



10
11
12
13
14
15
16
17
18
19
# File 'lib/axlsx/workbook/worksheet/auto_filter/sort_condition.rb', line 10

def initialize(column_index:, order:, custom_list:)
  Axlsx.validate_int column_index
  @column_index = column_index

  RestrictionValidator.validate 'SortCondition.order', [:asc, :desc], order
  @order = order

  DataTypeValidator.validate :sort_condition_custom_list, Array, custom_list
  @custom_list = custom_list
end