refactor: remove unnecessary block local variable

This commit is contained in:
Gonzalo Rodriguez 2019-03-01 22:01:17 -03:00
parent 5a42fd3ac7
commit 3639afc196
No known key found for this signature in database
GPG key ID: 5DB8B81B049B8AB1

View file

@ -50,13 +50,11 @@ class Rack::Attack
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)