lib/pagy/extras/overflow.rb in pagy-5.1.3 vs lib/pagy/extras/overflow.rb in pagy-5.2.0

- old
+ new

@@ -1,9 +1,9 @@ # See the Pagy documentation: https://ddnexus.github.io/pagy/extras/overflow # frozen_string_literal: true -class Pagy +class Pagy # :nodoc: DEFAULT[:overflow] = :empty_page # Handles OverflowError exceptions with different options module OverflowExtra # Support for Pagy class @@ -25,11 +25,12 @@ when :last_page initial_page = @vars[:page] # save the very initial page (even after re-run) initialize vars.merge!(page: @last) # re-run with the last page @vars[:page] = initial_page # restore the initial page when :empty_page - @offset = @items = @from = @to = 0 # vars relative to the actual page + @offset = @in = @from = @to = 0 # vars relative to the actual page + @utc_from = @utc_to = @final # calendar variables out of local_minmax @prev = @last # prev relative to the actual page extend Series # special series for :empty_page else raise VariableError.new(self, :overflow, 'to be in [:last_page, :empty_page, :exception]', @vars[:overflow]) end @@ -57,17 +58,18 @@ @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 + @offset = @in = @from = @to = 0 # vars relative to the actual page @vars[:size] = [] # no page in the series self else raise VariableError.new(self, :overflow, 'to be in [:empty_page, :exception]', @vars[:overflow]) end end end end prepend OverflowExtra::Pagy + Calendar.prepend OverflowExtra::Pagy if defined?(Calendar) Countless.prepend OverflowExtra::Countless if defined?(Countless) end