refactor: avoid unnecessary nil argument passing

This commit is contained in:
Gonzalo Rodriguez 2019-03-01 22:22:11 -03:00
parent 0e8dff4c88
commit fcb89a6c12
No known key found for this signature in database
GPG key ID: 5DB8B81B049B8AB1
3 changed files with 4 additions and 4 deletions

View file

@ -50,11 +50,11 @@ class Rack::Attack
end
def blocklist_ip(ip_address)
anonymous_blocklists << Blocklist.new(nil) { |request| IPAddr.new(ip_address).include?(IPAddr.new(request.ip)) }
anonymous_blocklists << Blocklist.new { |request| IPAddr.new(ip_address).include?(IPAddr.new(request.ip)) }
end
def safelist_ip(ip_address)
anonymous_safelists << Safelist.new(nil) { |request| IPAddr.new(ip_address).include?(IPAddr.new(request.ip)) }
anonymous_safelists << Safelist.new { |request| IPAddr.new(ip_address).include?(IPAddr.new(request.ip)) }
end
def throttle(name, options, &block)

View file

@ -3,7 +3,7 @@
module Rack
class Attack
class Blocklist < Check
def initialize(name, &block)
def initialize(name = nil, &block)
super
@type = :blocklist
end

View file

@ -3,7 +3,7 @@
module Rack
class Attack
class Safelist < Check
def initialize(name, &block)
def initialize(name = nil, &block)
super
@type = :safelist
end