lib/pagy/countless.rb in pagy-8.5.0 vs lib/pagy/countless.rb in pagy-8.6.0
- old
+ new
@@ -1,11 +1,11 @@
# See Pagy::Countless API documentation: https://ddnexus.github.io/pagy/docs/api/countless
# frozen_string_literal: true
require_relative '../pagy'
-class Pagy
+class Pagy # :nodoc:
# No need to know the count to paginate
class Countless < Pagy
# Merge and validate the options, do some simple arithmetic and set a few instance variables
def initialize(vars = {}) # rubocop:disable Lint/MissingSuper
normalize_vars(vars)
@@ -27,13 +27,16 @@
@to = @offset - @outset + @in
@prev = (@page - 1 unless @page == 1)
@next = @page == @last ? (1 if @vars[:cycle]) : @page + 1
self
end
+ end
+ module SeriesOverride # :nodoc:
# Override the original series.
# Return nil if :countless_minimal is enabled
def series(*, **)
super unless @vars[:countless_minimal]
end
end
+ prepend SeriesOverride
end