Sha256: 2ef5dc106d70744780b972d9269bb2276d2348921e35d61f086aac51cf5cae14

Contents?: true

Size: 666 Bytes

Versions: 80

Compression:

Stored size: 666 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_class
        case pagination_strategy.to_sym
        when :page
          LHS::Pagination::Page
        when :start
          LHS::Pagination::Start
        else
          LHS::Pagination::Offset
        end
      end

      def pagination(data)
        pagination_class.new(data)
      end
    end
  end
end

Version data entries

80 entries across 80 versions & 1 rubygems

Version Path
lhs-11.3.0 lib/lhs/concerns/record/pagination.rb
lhs-11.2.2 lib/lhs/concerns/record/pagination.rb
lhs-11.2.1 lib/lhs/concerns/record/pagination.rb
lhs-11.2.0 lib/lhs/concerns/record/pagination.rb
lhs-11.1.0 lib/lhs/concerns/record/pagination.rb
lhs-11.0.3 lib/lhs/concerns/record/pagination.rb
lhs-11.0.2 lib/lhs/concerns/record/pagination.rb
lhs-11.0.1 lib/lhs/concerns/record/pagination.rb
lhs-11.0.0 lib/lhs/concerns/record/pagination.rb
lhs-10.1.1 lib/lhs/concerns/record/pagination.rb
lhs-10.1.0 lib/lhs/concerns/record/pagination.rb
lhs-10.0.0 lib/lhs/concerns/record/pagination.rb
lhs-9.1.1 lib/lhs/concerns/record/pagination.rb
lhs-9.1.0 lib/lhs/concerns/record/pagination.rb
lhs-9.0.4 lib/lhs/concerns/record/pagination.rb
lhs-9.0.3 lib/lhs/concerns/record/pagination.rb
lhs-9.0.2 lib/lhs/concerns/record/pagination.rb
lhs-9.0.1 lib/lhs/concerns/record/pagination.rb
lhs-9.0.0 lib/lhs/concerns/record/pagination.rb
lhs-8.0.0 lib/lhs/concerns/record/pagination.rb