rails_throttle 0.1.0 → 0.2.0
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/.circleci/config.yml +1 -1
- data/README.md +2 -2
- data/lib/rails_throttle/throttle.rb +3 -3
- data/lib/rails_throttle/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: 492c5d6e293b452d648df87c5324fbc88a4673127b7a023449d2a238e058fcc4
|
4
|
+
data.tar.gz: 0ce27efa3cacce1d6ef4d2b48c7784a0cde6b8fb5a40612590fdd7854dd6eef9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab45d55646fe2e81133db0383e40ca071b0ad49df68d106a283ba49bfdffc179dfbe7a225a2dfadf8129afc351ba8116381c23e4953da9a9c4bad9ec8c859433
|
7
|
+
data.tar.gz: 5f9d4a40294454bd0377fb13d5af9da328f4b80330cb70d4038cf48d3fb3eaf04d3e583d1a0ee4cc93f777018b333f9f093436693088d664a6e11820a1d31920
|
data/.circleci/config.yml
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# RailsThrottle
|
1
|
+
# RailsThrottle [](https://circleci.com/gh/peterzhu2118/rails_throttle/tree/master) [](https://badge.fury.io/rb/rails_throttle)
|
2
2
|
|
3
3
|
RailsThrottle is a simple library used to throttle code in your Rails application.
|
4
4
|
|
@@ -20,7 +20,7 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
-
- See full documentation here:
|
23
|
+
- See full documentation here: https://www.rubydoc.info/gems/rails_throttle/0.1.0/RailsThrottle/Throttle
|
24
24
|
- Example configuration (for production, you can configure other environments in a similar way):
|
25
25
|
```ruby
|
26
26
|
# In config/environments/production.rb
|
@@ -13,7 +13,7 @@ module RailsThrottle
|
|
13
13
|
# parameters).
|
14
14
|
# @yieldparam [String] key The key that was passed in.
|
15
15
|
# @yieldparam [Integer] value The current value of the throttle counter.
|
16
|
-
# @return [Integer] The current value of the throttle counter.
|
16
|
+
# @return [Integer] The value of the block, or the current value of the throttle counter if no block is given.
|
17
17
|
def self.increment(key, options = {}, &block)
|
18
18
|
raise "Key cannot be blank" if key.blank?
|
19
19
|
|
@@ -42,9 +42,9 @@ module RailsThrottle
|
|
42
42
|
else
|
43
43
|
block.call(key, value)
|
44
44
|
end
|
45
|
+
else
|
46
|
+
value
|
45
47
|
end
|
46
|
-
|
47
|
-
value
|
48
48
|
end
|
49
49
|
|
50
50
|
# Decrements the counter for a given key.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_throttle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Zhu
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-04-
|
11
|
+
date: 2019-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|