Sha256: b6a978ec80612cc5483c18522174c4a970ebe8d0cdbc23df03778b6337b10026

Contents?: true

Size: 534 Bytes

Versions: 9

Compression:

Stored size: 534 Bytes

Contents

class RSolr::Ext::Response::FacetPaginator
  
  attr_reader :total, :items, :previous_offset, :next_offset
  
  def initialize(all_facet_values, offset, limit)
    offset = offset.to_s.to_i
    limit = limit.to_s.to_i
    total = all_facet_values.size
    @items = all_facet_values.slice(0, limit-1)
    @has_next = total == limit
    @has_previous = offset > 0
    @next_offset = offset + (limit-1)
    @previous_offset = offset - (limit-1)
  end

  def has_next?
    @has_next
  end

  def has_previous?
    @has_previous
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
mwmitchell-rsolr-ext-0.5.0 lib/rsolr-ext/response/facet_paginator.rb
mwmitchell-rsolr-ext-0.5.1 lib/rsolr-ext/response/facet_paginator.rb
mwmitchell-rsolr-ext-0.5.2 lib/rsolr-ext/response/facet_paginator.rb
mwmitchell-rsolr-ext-0.5.3 lib/rsolr-ext/response/facet_paginator.rb
mwmitchell-rsolr-ext-0.5.4 lib/rsolr-ext/response/facet_paginator.rb
mwmitchell-rsolr-ext-0.5.5 lib/rsolr-ext/response/facet_paginator.rb
mwmitchell-rsolr-ext-0.5.6 lib/rsolr-ext/response/facet_paginator.rb
mwmitchell-rsolr-ext-0.5.7 lib/rsolr-ext/response/facet_paginator.rb
mwmitchell-rsolr-ext-0.5.8 lib/rsolr-ext/response/facet_paginator.rb