prop 0.7.3 → 0.7.4

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.
data/README.md CHANGED
@@ -28,6 +28,9 @@ The `:mails_per_hour` in the above is called the "handle". You can now put the t
28
28
  # Throws Prop::RateLimitExceededError if the threshold/interval has been reached
29
29
  Prop.throttle!(:mails_per_hour)
30
30
 
31
+ # Prop can be used to guard a block of code
32
+ Prop.throttle!(:expensive_request) { calculator.something_very_hard }
33
+
31
34
  # Returns true if the threshold/interval has been reached
32
35
  Prop.throttled?(:mails_per_hour)
33
36
 
@@ -2,7 +2,7 @@ require "prop/limiter"
2
2
  require "forwardable"
3
3
 
4
4
  module Prop
5
- VERSION = "0.7.3"
5
+ VERSION = "0.7.4"
6
6
 
7
7
  # Short hand for accessing Prop::Limiter methods
8
8
  class << self
@@ -24,9 +24,15 @@ module Prop
24
24
  begin
25
25
  @app.call(env)
26
26
  rescue Prop::RateLimited => e
27
- @handler.call(env, e)
27
+ render_response(env, e)
28
28
  end
29
29
  end
30
+
31
+ protected
32
+
33
+ def render_response(env, error)
34
+ @handler.call(env, e)
35
+ end
30
36
  end
31
37
 
32
38
  end
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
13
13
  ## If your rubyforge_project name is different, then edit it and comment out
14
14
  ## the sub! line in the Rakefile
15
15
  s.name = 'prop'
16
- s.version = '0.7.3'
16
+ s.version = '0.7.4'
17
17
  s.date = '2012-04-06'
18
18
  s.rubyforge_project = 'prop'
19
19
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prop
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
- - 3
10
- version: 0.7.3
9
+ - 4
10
+ version: 0.7.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Morten Primdahl