Sha256: ac52cf3180c2eb7093a443a46c6ece021ac29df080435d94e6093976f917a991

Contents?: true

Size: 454 Bytes

Versions: 16

Compression:

Stored size: 454 Bytes

Contents

module PaginationSearch
  class PaginatedRecords
    def initialize(base_class, attribute_locations)
      @attribute_set = AttributeSet.new(base_class, attribute_locations)
    end

    def page_for(relation, params)
      id_relation = relation.select(:id)

      length = params[:limit].to_i
      start = params[:offset].to_i * length

      BaseRelation.new(id_relation, params, @attribute_set).process.limit(length).offset(start)
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
aleph_analytics-0.4.9.pre.dev lib/pagination_search/paginated_records.rb
aleph_analytics-0.4.8 lib/pagination_search/paginated_records.rb
aleph_analytics-0.4.7 lib/pagination_search/paginated_records.rb
aleph_analytics-0.4.4 lib/pagination_search/paginated_records.rb
aleph_analytics-0.4.2 lib/pagination_search/paginated_records.rb
aleph_analytics-0.4.1 lib/pagination_search/paginated_records.rb
aleph_analytics-0.3.0 lib/pagination_search/paginated_records.rb
aleph_analytics-0.2.0 lib/pagination_search/paginated_records.rb
aleph_analytics-0.1.0 lib/pagination_search/paginated_records.rb
aleph_analytics-0.0.6 lib/pagination_search/paginated_records.rb
aleph_analytics-0.0.5 lib/pagination_search/paginated_records.rb
aleph_analytics-0.0.4 lib/pagination_search/paginated_records.rb
aleph_analytics-0.0.3 lib/pagination_search/paginated_records.rb
aleph_analytics-0.0.2 lib/pagination_search/paginated_records.rb
aleph_analytics-0.0.1.alpha lib/pagination_search/paginated_records.rb
aleph_analytics-0.0.0.alpha lib/pagination_search/paginated_records.rb