lib/pagy/extras/gearbox.rb in pagy-5.0.0 vs lib/pagy/extras/gearbox.rb in pagy-5.0.1
- old
+ new
@@ -11,10 +11,10 @@
# Setup @items based on the :items variable
def setup_items_var
return super if !@vars[:gearbox_extra] || @vars[:items_extra]
gearbox_items = @vars[:gearbox_items]
- raise VariableError.new(self), "expected :gearbox_items to be an Array of positives; got #{gearbox_items.inspect}" \
+ raise VariableError.new(self, :gearbox_items, 'to be an Array of positives', gearbox_items) \
unless gearbox_items.is_a?(Array) && gearbox_items.all? { |num| num.positive? rescue false } # rubocop:disable Style/RescueModifier
@items = gearbox_items[@page - 1] || gearbox_items.last
end