Pass serializer through from Clover#paginated_result. Also, have Pagination#paginated_result use :items instead of :records as the hash key. This allows Clover#paginated_result to use the result directly. There are no callers of Pagination#paginated_result other than Clover#paginated_result, so this change is safe. The main reason to keep Pagination#paginated_result as a separate method is to allow for easier testing.
14 lines
320 B
Ruby
14 lines
320 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Clover < Roda
|
|
def paginated_result(dataset, serializer)
|
|
opts = typecast_params.convert!(symbolize: true) do |tp|
|
|
tp.str(%w[start_after order_column])
|
|
tp.pos_int("page_size")
|
|
end
|
|
opts[:serializer] = serializer
|
|
|
|
dataset.paginated_result(**opts)
|
|
end
|
|
end
|