Sha256: 7a5ef384dc35c446cf1609ff5f70a9b8ee5d153271113298a975705914a7746f

Contents?: true

Size: 334 Bytes

Versions: 35

Compression:

Stored size: 334 Bytes

Contents

# frozen_string_literal: true

module Motor
  module ApiQuery
    module Paginate
      MAX_PER_PAGE = 500

      module_function

      def call(rel, params)
        params ||= {}

        rel = rel.limit([MAX_PER_PAGE, (params[:limit] || MAX_PER_PAGE).to_i].min)
        rel.offset(params[:offset].to_i)
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
motor-admin-0.1.49 lib/motor/api_query/paginate.rb
motor-admin-0.1.48 lib/motor/api_query/paginate.rb
motor-admin-0.1.47 lib/motor/api_query/paginate.rb
motor-admin-0.1.46 lib/motor/api_query/paginate.rb
motor-admin-0.1.44 lib/motor/api_query/paginate.rb
motor-admin-0.1.43 lib/motor/api_query/paginate.rb
motor-admin-0.1.42 lib/motor/api_query/paginate.rb
motor-admin-0.1.41 lib/motor/api_query/paginate.rb
motor-admin-0.1.40 lib/motor/api_query/paginate.rb
motor-admin-0.1.39 lib/motor/api_query/paginate.rb
motor-admin-0.1.37 lib/motor/api_query/paginate.rb
motor-admin-0.1.36 lib/motor/api_query/paginate.rb
motor-admin-0.1.35 lib/motor/api_query/paginate.rb
motor-admin-0.1.34 lib/motor/api_query/paginate.rb
motor-admin-0.1.33 lib/motor/api_query/paginate.rb
motor-admin-0.1.32 lib/motor/api_query/paginate.rb
motor-admin-0.1.31 lib/motor/api_query/paginate.rb
motor-admin-0.1.29 lib/motor/api_query/paginate.rb
motor-admin-0.1.28 lib/motor/api_query/paginate.rb
motor-admin-0.1.27 lib/motor/api_query/paginate.rb