Sha256: fe7f63f6148102923e2bd8a42e1eaf1bf6eb7772e181402655aa7f26e4fe1f60

Contents?: true

Size: 510 Bytes

Versions: 3

Compression:

Stored size: 510 Bytes

Contents

module Nazrin
  module PaginationGenerator
    module WillPaginateGenerator
      def self.call(collection, options)
        begin
          require 'will_paginate/collection'
        rescue LoadError
          abort "Missing dependency 'will_paginate' for pagination"
        end

        WillPaginate::Collection.create(options[:current_page], options[:per_page], options[:total_count]) do |pager|
          pager.replace collection[pager.offset, pager.per_page].to_a
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nazrin-1.0.1 lib/nazrin/pagination_generator/will_paginate_generator.rb
nazrin-1.0.0 lib/nazrin/pagination_generator/will_paginate_generator.rb
nazrin-0.2.0 lib/nazrin/pagination_generator/will_paginate_generator.rb