Permalink
Browse files

Ensured that TimeWindow inputs are correctly duck-typed.

  • Loading branch information...
1 parent 64639d7 commit 13f44f92e8f2bad70fc11fcfae3472998d6e9733 Arto Bendiken committed Mar 22, 2010
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/rack/throttle/time_window.rb
@@ -9,7 +9,7 @@ class TimeWindow < Limiter
# @return [Boolean]
def allowed?(request)
count = cache_get(key = cache_key(request)).to_i + 1 rescue 1
- allowed = count <= max_per_window
+ allowed = count <= max_per_window.to_i
begin
cache_set(key, count)
allowed

0 comments on commit 13f44f9

Please sign in to comment.