Sha256: a6f2ef94500c388cbf543d02c2a82282ef92624344b62c6e37e6452b1ab2d636

Contents?: true

Size: 368 Bytes

Versions: 5

Compression:

Stored size: 368 Bytes

Contents

# frozen_string_literal: true

class DHS::Pagination::Link < DHS::Pagination::Base
  def total
    data._raw.dig(*_record.items_key).count || 0
  end

  alias count total

  def next(current)
    current.dig(:next, :href)
  end

  def pages_left
    pages_left? ? 1 : 0
  end

  def pages_left?
    data._raw[:next].present?
  end

  def parallel?
    false
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dhs-1.6.0 lib/dhs/pagination/link.rb
dhs-1.5.0 lib/dhs/pagination/link.rb
dhs-1.4.2 lib/dhs/pagination/link.rb
dhs-1.4.1 lib/dhs/pagination/link.rb
dhs-1.4.0 lib/dhs/pagination/link.rb