Sha256: e86e27792ed8915d044dcac8ec966d93e624e10fc181bdcd1e2bced8651c91b3

Contents?: true

Size: 276 Bytes

Versions: 38

Compression:

Stored size: 276 Bytes

Contents

class LHS::Pagination::Start < LHS::Pagination::Base

  def current_page
    (offset + limit - 1) / 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 + 1
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

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