module Pagy::Countless::UseOverflowExtra

Public Instance Methods

finalize(items) click to toggle source
Calls superclass method
# File lib/pagy/extras/overflow.rb, line 54
def finalize(items)
  @overflow = false
  super
rescue OverflowError
  @overflow = true                        # add the overflow flag
  case @vars[:overflow]
  when :exception
    raise                                 # same as without the extra
  when :empty_page
    @offset = @items = @from = @to = 0    # vars relative to the actual page
    @vars[:size] = []                     # no page in the series
    self
  else
    raise VariableError.new(self), "expected :overflow variable in [:empty_page, :exception]; got #{@vars[:overflow].inspect}"
  end
end