From 9fb11951d95aaaf233e33d0fc04b3e1126fdfb8a Mon Sep 17 00:00:00 2001
From: Domizio Demichelis
Date: Fri, 16 Apr 2021 12:35:04 +0700
Subject: [PATCH] more verbose condition
---
lib/pagy.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/pagy.rb b/lib/pagy.rb
index 93e792bde..964cb1dcc 100644
--- a/lib/pagy.rb
+++ b/lib/pagy.rb
@@ -44,7 +44,7 @@ def initialize(vars)
def series(size=@vars[:size])
return [] if size.empty?
raise VariableError.new(self), "expected 4 items >= 0 in :size; got #{size.inspect}" \
- unless size.size == 4 && size.all?{ |num| num >= 0 rescue false } # rubocop:disable Style/RescueModifier
+ unless size.size == 4 && size.all?{ |num| !num.negative? rescue false } # rubocop:disable Style/RescueModifier
# This algorithm is up to ~5x faster and ~2.3x lighter than the previous one (pagy < 4.3)
left_gap_start = 1 + size[0]
left_gap_end = @page - size[1] - 1