lib/nazrin/pagination_generator.rb in nazrin-1.0.1 vs lib/nazrin/pagination_generator.rb in nazrin-2.0.0.rc1
- old
+ new
@@ -1,20 +1,14 @@
module Nazrin
module PaginationGenerator
- SUPPORTED_PAGINATION_GEMS = %w(nazrin kaminari will_paginate)
-
class << self
def generate(collection, options = {})
- abort "#{Nazrin.config.pagination} is not supported gem of pagination" unless SUPPORTED_PAGINATION_GEMS.include?(Nazrin.config.pagination.to_s)
-
- retreive_generator_module.call(collection, options)
- end
-
- private
-
- def retreive_generator_module
- require "nazrin/pagination_generator/#{Nazrin.config.pagination}_generator"
- Nazrin::PaginationGenerator.const_get("#{Nazrin.config.pagination.to_s.camelize}Generator")
+ Nazrin::PaginatedArray.new(
+ collection,
+ options[:current_page],
+ options[:per_page],
+ options[:total_count]
+ )
end
end
end
end