Sha256: 715bb579ebdf0efb241040ef00eef0eccd688edbb15beb0ef63c93222e71bbd5

Contents?: true

Size: 992 Bytes

Versions: 41

Compression:

Stored size: 992 Bytes

Contents

unless defined? Kaminari
  raise(AlgoliaSearch::BadConfiguration, "AlgoliaSearch: Please add 'kaminari' to your Gemfile to use kaminari pagination backend")
end

module AlgoliaSearch
  module Pagination
    class Kaminari < Array
      include ::Kaminari::ConfigurationMethods::ClassMethods
      include ::Kaminari::PageScopeMethods

      attr_reader :limit_value, :offset_value, :total_count

      def initialize(original_array, limit_val, offset_val, total_count)
        @limit_value = limit_val || default_per_page
        @offset_value, @total_count = offset_val, total_count
        super(original_array)
      end

      def page(num = 1)
        self
      end

      def limit(num)
        self
      end

      def current_page
        offset_value+1
      end

      class << self
        def create(results, total_hits, options = {})
          instance = new(results, options[:per_page], options[:page]-1, total_hits)
          instance
        end
      end
    end
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
algoliasearch-rails-1.9.1 lib/algoliasearch/pagination/kaminari.rb
algoliasearch-rails-1.9.0 lib/algoliasearch/pagination/kaminari.rb
algoliasearch-rails-1.8.2 lib/algoliasearch/pagination/kaminari.rb
algoliasearch-rails-1.8.1 lib/algoliasearch/pagination/kaminari.rb
algoliasearch-rails-1.8.0 lib/algoliasearch/pagination/kaminari.rb
algoliasearch-rails-1.7.2 lib/algoliasearch/pagination/kaminari.rb
algoliasearch-rails-1.7.1 lib/algoliasearch/pagination/kaminari.rb
algoliasearch-rails-1.7.0 lib/algoliasearch/pagination/kaminari.rb
algoliasearch-rails-1.6.3 lib/algoliasearch/pagination/kaminari.rb
algoliasearch-rails-1.6.2 lib/algoliasearch/pagination/kaminari.rb
algoliasearch-rails-1.6.1 lib/algoliasearch/pagination/kaminari.rb
algoliasearch-rails-1.5.2 lib/algoliasearch/pagination/kaminari.rb
algoliasearch-rails-1.5.1 lib/algoliasearch/pagination/kaminari.rb
algoliasearch-rails-1.4.5 lib/algoliasearch/pagination/kaminari.rb
algoliasearch-rails-1.4.4 lib/algoliasearch/pagination/kaminari.rb
algoliasearch-rails-1.4.3 lib/algoliasearch/pagination/kaminari.rb
algoliasearch-rails-1.4.2 lib/algoliasearch/pagination/kaminari.rb
algoliasearch-rails-1.4.1 lib/algoliasearch/pagination/kaminari.rb
algoliasearch-rails-1.3.10 lib/algoliasearch/pagination/kaminari.rb
algoliasearch-rails-1.3.9 lib/algoliasearch/pagination/kaminari.rb