cursory 1.0.5 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/cursory/base.rb +2 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3cf415457c8ad13aeac7ee90884c3f03cf8bb35b
|
4
|
+
data.tar.gz: 1ed8963dbc8e3b0fcb0f97fe073b4ca98a18e0ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a0a340d26379cd248dab4d6f1e14815bc311d0bd24fc10501d2c24e3a90f3ce639f5ecea5a97ed843a635957fead436240083aa1a8fa325934fda841d335954
|
7
|
+
data.tar.gz: 6d604e5fb23bc58ebcfad715aaba9fd9c8bdba343f9194239bf1273bd34a83684daef848f1a221e2fd519d267c00d8582c9cb1408b26aef17f94d01312e59203
|
data/lib/cursory/base.rb
CHANGED
@@ -6,6 +6,7 @@ module Cursory
|
|
6
6
|
attr_accessor *%i{criteria sort limit offset cursor}
|
7
7
|
|
8
8
|
MAX_LIMIT = 100
|
9
|
+
DEFAULT_LIMIT = 10
|
9
10
|
SORT_KEY, LIMIT_KEY, CURSOR_KEY, OFFSET_KEY = %i{sort limit cursor offset}
|
10
11
|
|
11
12
|
def initialize criteria, params
|
@@ -95,7 +96,7 @@ module Cursory
|
|
95
96
|
end
|
96
97
|
|
97
98
|
def clamped_limit
|
98
|
-
[1, limit.to_i, MAX_LIMIT].sort[1]
|
99
|
+
[1, (limit || DEFAULT_LIMIT).to_i, MAX_LIMIT].sort[1]
|
99
100
|
end
|
100
101
|
|
101
102
|
def cursor_clauses
|