Skip to content
Permalink
Browse files

refactor: remove unnecessary block local variable

  • Loading branch information...
grzuy committed Mar 2, 2019
1 parent 5a42fd3 commit 3639afc196249c1b143327c559086af5a9d55bc3
Showing with 2 additions and 4 deletions.
  1. +2 −4 lib/rack/attack.rb
@@ -50,13 +50,11 @@ def blocklist(name = nil, &block)
end

def blocklist_ip(ip_address)
ip_blocklist_proc = lambda { |request| IPAddr.new(ip_address).include?(IPAddr.new(request.ip)) }
anonymous_blocklists << Blocklist.new(nil, &ip_blocklist_proc)
anonymous_blocklists << Blocklist.new(nil) { |request| IPAddr.new(ip_address).include?(IPAddr.new(request.ip)) }
end

def safelist_ip(ip_address)
ip_safelist_proc = lambda { |request| IPAddr.new(ip_address).include?(IPAddr.new(request.ip)) }
anonymous_safelists << Safelist.new(nil, &ip_safelist_proc)
anonymous_safelists << Safelist.new(nil) { |request| IPAddr.new(ip_address).include?(IPAddr.new(request.ip)) }
end

def throttle(name, options, &block)

0 comments on commit 3639afc

Please sign in to comment.
You can’t perform that action at this time.