app/sorters/bmc/sorter.rb in bmc-1.4.0 vs app/sorters/bmc/sorter.rb in bmc-1.4.1
- old
+ new
@@ -1,10 +1,14 @@
class BMC::Sorter
include BMC::SortingHelper
attr_reader :collection, :sort_param, :column, :direction
+ def self.call(...)
+ new(...).call
+ end
+
def initialize(collection, sort_param = nil)
@collection = collection
@sort_param = sort_param
@column, @direction = sortable_column_order(sort_param.to_s)
end
@@ -16,13 +20,9 @@
def call
# Don't replace by `collection.reorder(sort)`
# #sort can change #collection and must be called before #collection
order = sort
collection.reorder(order)
- end
-
- def self.call(...)
- new(...).call
end
private
def inverted_direction