lib/pagy/countless.rb in pagy-3.12.0 vs lib/pagy/countless.rb in pagy-3.13.0
- old
+ new
@@ -6,10 +6,10 @@
class Pagy
class Countless < Pagy
# Merge and validate the options, do some simple arithmetic and set a few instance variables
- def initialize(vars={})
+ def initialize(vars={}) # rubocop:disable Lint/MissingSuper
@vars = VARS.merge(vars.delete_if{|_,v| v.nil? || v == '' }) # default vars + cleaned vars (can be overridden)
{ items:1, outset:0, page:1 }.each do |k,min| # validate instance variables
(@vars[k] && instance_variable_set(:"@#{k}", @vars[k].to_i) >= min) \
or raise(VariableError.new(self), "expected :#{k} >= #{min}; got #{@vars[k].inspect}")
end