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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5a2ab53fa629af87782ad13972070920c48a8fae2fc3d9988abc7ade286b2f58
4
- data.tar.gz: f16a39aa3e229b5eee2c357517f2731174b7649b09acf411133d863899a73d2c
3
+ metadata.gz: ff72f569e06461388653d0301fc523626fb2d738bce4cee23eeb097790a89948
4
+ data.tar.gz: 0b742c43b55c24367a7294f24c273b9d6a75719368d2a9163734110b22d74afb
5
5
  SHA512:
6
- metadata.gz: de129122de6f46a98590b6fdc1d786952f74d71e6023bbf1e5d88b8232f7caf2849db6c4947792dab6bc23feaa31d82bfabafe3744e13402944795868c200614
7
- data.tar.gz: 4aacbd42bfdb8b3c28e152daddc789966112b0acaf6aebd388882c60b915512b8c0908ca02182cadde72e9d65ebd9ad68bad73e4d1a3d457aa93f623f0a9b3ce
6
+ metadata.gz: 5d043f55d66eb179c98da96d004b5d06ee7c17e2e67d39b046734d0f08831022c34294eae5809dc49d17900883ad267e05150c2176e512692651019e4a98b749
7
+ data.tar.gz: 666c16e6a708464cd628814ade3ba3d451b8490abf1a6450e7dad80b7544a000a4a07a264e8df1b3d2a258da8f40b5a5e4333e5c8a0cfcde979af989c506a089
@@ -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
- @app.resolve(scope.limit(params[:limit] || default_limit), params)
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
@@ -10,7 +10,7 @@ module Rhino
10
10
  MAJOR = 0
11
11
  MINOR = 22
12
12
  TINY = 0
13
- PRE = "beta.5"
13
+ PRE = "beta.7"
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
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.5
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-06 00:00:00.000000000 Z
11
+ date: 2024-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails