Sha256: 4a66a2559bc9924eef32471e477f81fedbdb6a26753ba1fac29ba225260575ad

Contents?: true

Size: 495 Bytes

Versions: 2

Compression:

Stored size: 495 Bytes

Contents

module Nazrin
  module PaginationGenerator
    module KaminariGenerator
      def self.call(collection, options)
        begin
          require 'kaminari'
        rescue LoadError
          abort "Missing dependency 'kaminari' for pagination"
        end
        Kaminari.config.max_pages = options[:last_page]
        Kaminari.paginate_array(collection, total_count: options[:total_count])
          .page(options[:current_page])
          .per(options[:per_page])
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nazrin-1.0.0 lib/nazrin/pagination_generator/kaminari_generator.rb
nazrin-0.2.0 lib/nazrin/pagination_generator/kaminari_generator.rb