Skip to content

Commit

Permalink
added missing deprecation to countless class
Browse files Browse the repository at this point in the history
  • Loading branch information
ddnexus committed Aug 20, 2021
1 parent bedb2d6 commit ed6bc0b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/pagy/countless.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ 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
@vars = VARS.merge(vars.delete_if{|_,v| v.nil? || v == '' }) # default vars + cleaned vars (can be overridden)
@vars[:fragment] = Pagy.deprecated_var(:anchor, @vars[:anchor], :fragment, @vars[:fragment]) if @vars[:anchor]

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
Expand Down

0 comments on commit ed6bc0b

Please sign in to comment.