istox 0.1.114 → 0.1.115

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f0fd11929f5853a08a199a47e6959dfc57dbbe45230656f0954af44cbb351890
4
- data.tar.gz: 20ed7facb33b36e0d26cba19aa96a29eaeeafc3c004b2c484705e84072613110
3
+ metadata.gz: cf656e8345ac7129697ea2a2366a417de683989f09b627fb4d71b062678fce32
4
+ data.tar.gz: 959ca575d5ffa3044965cbd1224e7174cd961db3d5f6f5eb5892441cc9db124f
5
5
  SHA512:
6
- metadata.gz: 2f601579de1c82b4aefc82c81031d7e31eb6e268326376a77aa5eae7931be6299354802bd3e91809c4304634b9ce9451f3e756f04ab13d0416115881d15cf7e9
7
- data.tar.gz: 06635e08d320336b4695de7f946d2fb0319e66d54d170aaa80a06005945c8f23cfbe0e2f33285edb92225b1d55d5e1536852d51fc5cc2d4cd68f9be22760f4ff
6
+ metadata.gz: 471dd7ceef7f24b765837cd0a9144c22b00cd22a422df83002890ab4706d22b502b681f161fbe1350faca263a7f95e2965438f2381142d183bc46b5cbe7e7c66
7
+ data.tar.gz: 695beb8e1b6b9d2de1a5c57ef6022e6d52d41bd1f890a12598fe9ef3a28df24cbbae6ce56d9dc9799c2dd4fa122d344a3d13966c36a0b0db96eac6d25b8d8e44
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- istox (0.1.113)
4
+ istox (0.1.114)
5
5
  awesome_print
6
6
  binding_of_caller
7
7
  bunny (>= 2.12.0)
@@ -92,8 +92,9 @@ module Istox
92
92
  # @option options [Integer] :interval How far back to retrieve activity.
93
93
  # @option options [Integer] :threshold Maximum number of actions
94
94
  def limit!(subject, options = {})
95
- add(subject)
96
95
  raise ::Istox::RateLimitExceedError if exceeded?(subject, options)
96
+
97
+ add(subject)
97
98
  end
98
99
 
99
100
  # Check if next execution will cause the rate limit to be exceeded, return false if exceeded, else return true
@@ -103,8 +104,13 @@ module Istox
103
104
  # @option options [Integer] :interval How far back to retrieve activity.
104
105
  # @option options [Integer] :threshold Maximum number of actions
105
106
  def limit?(subject, options = {})
107
+ result = within_bounds?(subject, options)
108
+
109
+ return result unless result
110
+
106
111
  add(subject)
107
- within_bounds?(subject, options)
112
+
113
+ true
108
114
  end
109
115
 
110
116
  # Execute a block once the rate limit is within bounds
@@ -1,3 +1,3 @@
1
1
  module Istox
2
- VERSION = '0.1.114'.freeze
2
+ VERSION = '0.1.115'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: istox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.114
4
+ version: 0.1.115
5
5
  platform: ruby
6
6
  authors:
7
7
  - Siong Leng