Sha256: 43eff68d28fc28bb252bbdf181a77e53683884a2f1331957e9a5e3464d08eb9a

Contents?: true

Size: 269 Bytes

Versions: 38

Compression:

Stored size: 269 Bytes

Contents

class LHS::Pagination::Offset < LHS::Pagination::Base

  def current_page
    (offset + limit) / limit
  end

  def next_offset(step = 1)
    offset + limit * step
  end

  def self.page_to_offset(page, limit = DEFAULT_LIMIT)
    (page.to_i - 1) * limit.to_i
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
lhs-13.2.3 lib/lhs/pagination/offset.rb
lhs-13.2.2 lib/lhs/pagination/offset.rb
lhs-13.2.1 lib/lhs/pagination/offset.rb
lhs-13.2.0 lib/lhs/pagination/offset.rb
lhs-13.1.0 lib/lhs/pagination/offset.rb
lhs-13.0.1 lib/lhs/pagination/offset.rb
lhs-13.0.0 lib/lhs/pagination/offset.rb
lhs-12.3.0 lib/lhs/pagination/offset.rb
lhs-12.2.1 lib/lhs/pagination/offset.rb
lhs-12.2.0 lib/lhs/pagination/offset.rb
lhs-12.1.0 lib/lhs/pagination/offset.rb
lhs-12.0.3 lib/lhs/pagination/offset.rb
lhs-12.0.2 lib/lhs/pagination/offset.rb
lhs-12.0.1 lib/lhs/pagination/offset.rb
lhs-12.0.0 lib/lhs/pagination/offset.rb
lhs-11.3.3 lib/lhs/pagination/offset.rb
lhs-11.3.2 lib/lhs/pagination/offset.rb
lhs-11.3.1 lib/lhs/pagination/offset.rb
lhs-11.3.0 lib/lhs/pagination/offset.rb
lhs-11.2.2 lib/lhs/pagination/offset.rb