class Pagy::Countless
def initialize(vars={}) # rubocop:disable Lint/MissingSuper
Merge and validate the options, do some simple arithmetic and set a few instance variables
def initialize(vars={}) # rubocop:disable Lint/MissingSuper @vars = VARS.merge(vars.delete_if{|_,v| v.nil? || v == '' }) # default vars + cleaned vars (can be overridden) INSTANCE_VARS_MIN.each do |k,min| # validate instance variables raise VariableError.new(self), "expected :#{k} >= #{min}; got #{@vars[k].inspect}" \ unless @vars[k] && instance_variable_set(:"@#{k}", @vars[k].to_i) >= min end @offset = @items * (@page - 1) + @outset # pagination offset + outset (initial offset) end