Sha256: 2ae1a15989ebefc3c54a2d440f3bced125f04718d6379f65cfa96526af580a83

Contents?: true

Size: 427 Bytes

Versions: 13

Compression:

Stored size: 427 Bytes

Contents

require 'active_support'

class LHS::Record

  module Pagination
    extend ActiveSupport::Concern

    def current_page
      offset + 1
    end

    def first_page
      1
    end

    def last_page
      total_pages
    end

    def prev_page
      current_page - 1
    end

    def next_page
      current_page + 1
    end

    def limit_value
      limit
    end

    def total_pages
      total / limit
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
lhs-3.4.2 lib/lhs/concerns/record/pagination.rb
lhs-3.4.1 lib/lhs/concerns/record/pagination.rb
lhs-3.4.0 lib/lhs/concerns/record/pagination.rb
lhs-3.3.6 lib/lhs/concerns/record/pagination.rb
lhs-3.3.5 lib/lhs/concerns/record/pagination.rb
lhs-3.3.3 lib/lhs/concerns/record/pagination.rb
lhs-3.3.2 lib/lhs/concerns/record/pagination.rb
lhs-3.3.1 lib/lhs/concerns/record/pagination.rb
lhs-3.3.0 lib/lhs/concerns/record/pagination.rb
lhs-3.2.0 lib/lhs/concerns/record/pagination.rb
lhs-3.1.3 lib/lhs/concerns/record/pagination.rb
lhs-3.1.1 lib/lhs/concerns/record/pagination.rb
lhs-3.1.0 lib/lhs/concerns/record/pagination.rb