prop 2.2.2 → 2.2.4

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
  SHA1:
3
- metadata.gz: 498e7350ae324646b31fc30a658b2443db9d3c63
4
- data.tar.gz: 0dcb095217edd32a792d28ce7d2f4f1a0326a161
3
+ metadata.gz: dc6f4c4c65b63f97ad2ae286c7bdfcba9340e392
4
+ data.tar.gz: b5757a4efe766900a87c73f3631ea28d26924ef1
5
5
  SHA512:
6
- metadata.gz: 58474567c9da9f71375bb6d6f8495cb3a6de8c40d80745893666d1f76a68c76cf37d6cec7c193ff09ba23531e9cdcbec2f1a67211b8ace2c1a374853cfbd9b31
7
- data.tar.gz: 296742370594a33d4247a3dc90b61597e27dac960eb56701bd7b18661b110673022ed27222ea58de7230b547e8f2bb1f684ed44ed47cf035ba88bca2a62ec4e5
6
+ metadata.gz: 3bb9cbe78d81e7bca791d46f67c6ef1776c7c939f56656ed53b05b8568a2e08dc9b2b738e056c38ce3586f68f8e9b7f4a02ff1fd736be29c0d70bf9acf015cee
7
+ data.tar.gz: 34d62bedf1c439e6fa784a19b9a0f59e6dd8bbe2d152cceda3f63b5fbd58db603e43212d6d786ed2a36294fe6f73db5e0f58cc94c86656a34702d0b958216983
@@ -3,7 +3,7 @@ require "prop/limiter"
3
3
  require "forwardable"
4
4
 
5
5
  module Prop
6
- VERSION = "2.2.2"
6
+ VERSION = "2.2.4"
7
7
 
8
8
  # Short hand for accessing Prop::Limiter methods
9
9
  class << self
@@ -15,12 +15,12 @@ module Prop
15
15
 
16
16
  # options argument is kept for api consistency for all strategies
17
17
  def increment(cache_key, amount, options = {})
18
- raise ArgumentError, "Change amount must be a Fixnum, was #{amount.class}" unless amount.is_a?(Fixnum)
18
+ raise ArgumentError, "Change amount must be a Integer, was #{amount.class}" unless amount.is_a?(Integer)
19
19
  cache.increment(cache_key, amount) || (cache.write(cache_key, amount, raw: true) && amount) # WARNING: potential race condition
20
20
  end
21
21
 
22
22
  def decrement(cache_key, amount, options = {})
23
- raise ArgumentError, "Change amount must be a Fixnum, was #{amount.class}" unless amount.is_a?(Fixnum)
23
+ raise ArgumentError, "Change amount must be a Integer, was #{amount.class}" unless amount.is_a?(Integer)
24
24
  cache.decrement(cache_key, amount) || (cache.write(cache_key, 0, raw: true) && 0) # WARNING: potential race condition
25
25
  end
26
26
 
@@ -61,14 +61,14 @@ module Prop
61
61
 
62
62
  amount = options[:increment] || options[:decrement]
63
63
  if amount
64
- raise ArgumentError.new(":increment or :decrement must be zero or a positive Integer") if !amount.is_a?(Fixnum) || amount < 0
64
+ raise ArgumentError.new(":increment or :decrement must be zero or a positive Integer") if !amount.is_a?(Integer) || amount < 0
65
65
  end
66
66
  end
67
67
 
68
68
  private
69
69
 
70
70
  def validate_positive_integer(option, key)
71
- raise ArgumentError.new("#{key.inspect} must be a positive Integer") if !option.is_a?(Fixnum) || option <= 0
71
+ raise ArgumentError.new("#{key.inspect} must be a positive Integer") if !option.is_a?(Integer) || option <= 0
72
72
  end
73
73
 
74
74
  def cache
@@ -59,7 +59,7 @@ module Prop
59
59
  def validate_options!(options)
60
60
  Prop::IntervalStrategy.validate_options!(options)
61
61
 
62
- if !options[:burst_rate].is_a?(Fixnum) || options[:burst_rate] < options[:threshold]
62
+ if !options[:burst_rate].is_a?(Integer) || options[:burst_rate] < options[:threshold]
63
63
  raise ArgumentError.new(":burst_rate must be an Integer and not less than :threshold")
64
64
  end
65
65
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prop
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 2.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Morten Primdahl
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-16 00:00:00.000000000 Z
11
+ date: 2017-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -116,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
116
  version: '0'
117
117
  requirements: []
118
118
  rubyforge_project:
119
- rubygems_version: 2.4.5.1
119
+ rubygems_version: 2.6.11
120
120
  signing_key:
121
121
  specification_version: 4
122
122
  summary: Gem for implementing rate limits.