Sha256: d257dcb781cc02668cb751d076a0fbf2e0d008a1ecf85d0f26c47cc4bfabee95

Contents?: true

Size: 615 Bytes

Versions: 11

Compression:

Stored size: 615 Bytes

Contents

require 'active_support'

class LHS::Record

  module Pagination
    extend ActiveSupport::Concern
    # Kaminari-Interface
    delegate :current_page, :first_page, :last_page, :prev_page, :next_page, :limit_value, :total_pages, to: :_pagination

    def _pagination
      self.class.pagination(_data)
    end

    module ClassMethods
      def pagination(data)
        case data._record.pagination_strategy.to_sym
        when :page
          PagePagination.new(data)
        when :start
          StartPagination.new(data)
        else
          OffsetPagination.new(data)
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
lhs-5.3.0 lib/lhs/concerns/record/pagination.rb
lhs-5.2.0 lib/lhs/concerns/record/pagination.rb
lhs-5.1.0 lib/lhs/concerns/record/pagination.rb
lhs-5.0.4 lib/lhs/concerns/record/pagination.rb
lhs-5.0.3 lib/lhs/concerns/record/pagination.rb
lhs-5.0.1 lib/lhs/concerns/record/pagination.rb
lhs-5.0.0 lib/lhs/concerns/record/pagination.rb
lhs-4.2.1 lib/lhs/concerns/record/pagination.rb
lhs-4.2.0 lib/lhs/concerns/record/pagination.rb
lhs-4.1.0 lib/lhs/concerns/record/pagination.rb
lhs-4.0.0 lib/lhs/concerns/record/pagination.rb