Sha256: d88aad92a54bec5b16a5c53cc6d45d56d64a4ead47172386a4d4c89f5bd3c466

Contents?: true

Size: 660 Bytes

Versions: 3

Compression:

Stored size: 660 Bytes

Contents

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")
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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