Module: Pagy::OverflowExtra::Countless
- Included in:
- Countless
- Defined in:
- lib/pagy/extras/overflow.rb
Overview
Support for Pagy::Countless class
Instance Method Summary collapse
-
#finalize(items) ⇒ Object
Add rescue clause for different behaviors.
Instance Method Details
#finalize(items) ⇒ Object
Add rescue clause for different behaviors
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/pagy/extras/overflow.rb', line 57 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, :overflow, 'to be in [:empty_page, :exception]', @vars[:overflow]) end end |