rhino_project_core 0.22.0.beta.5 → 0.22.0.beta.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rhino/sieve/limit.rb +9 -3
- data/lib/rhino/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff72f569e06461388653d0301fc523626fb2d738bce4cee23eeb097790a89948
|
4
|
+
data.tar.gz: 0b742c43b55c24367a7294f24c273b9d6a75719368d2a9163734110b22d74afb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d043f55d66eb179c98da96d004b5d06ee7c17e2e67d39b046734d0f08831022c34294eae5809dc49d17900883ad267e05150c2176e512692651019e4a98b749
|
7
|
+
data.tar.gz: 666c16e6a708464cd628814ade3ba3d451b8490abf1a6450e7dad80b7544a000a4a07a264e8df1b3d2a258da8f40b5a5e4333e5c8a0cfcde979af989c506a089
|
data/lib/rhino/sieve/limit.rb
CHANGED
@@ -3,17 +3,23 @@
|
|
3
3
|
module Rhino
|
4
4
|
module Sieve
|
5
5
|
class Limit
|
6
|
-
attr_accessor :default_limit
|
6
|
+
attr_accessor :default_limit, :max_limit
|
7
7
|
|
8
|
-
def initialize(app, default_limit: 20)
|
8
|
+
def initialize(app, default_limit: 20, max_limit: 100)
|
9
9
|
@app = app
|
10
10
|
|
11
11
|
@default_limit = default_limit
|
12
|
+
@max_limit = max_limit
|
12
13
|
end
|
13
14
|
|
14
15
|
# limit=20
|
15
16
|
def resolve(scope, params)
|
16
|
-
|
17
|
+
# If we get a non-nil limit param we try and construct it as an integer
|
18
|
+
# Otherwise we use the default
|
19
|
+
param_limit = params[:limit].nil? ? default_limit : params[:limit].to_i
|
20
|
+
|
21
|
+
# Don't allow a limit above the max_limit
|
22
|
+
@app.resolve(scope.limit([param_limit, max_limit].min), params)
|
17
23
|
end
|
18
24
|
end
|
19
25
|
end
|
data/lib/rhino/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rhino_project_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.22.0.beta.
|
4
|
+
version: 0.22.0.beta.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JP Rosevear
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-12-
|
11
|
+
date: 2024-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|