rack-attack/lib/rack/attack/base_proxy.rb
Santiago Bartesaghi e9f472786a
Update rubocop (#629)
* Upgrade rubocop gem

* Fix obsolete parameter

* Fix Lint/MissingSuper

* Fix Lint/ConstantDefinitionInBlock

* Fix Layout/EmptyLineBetweenDefs

* Add rubocop-minitest

* Add rubocop-rake

* Upgrade rubocop-performance
2023-10-16 20:04:35 -03:00

28 lines
480 B
Ruby

# frozen_string_literal: true
require 'delegate'
module Rack
class Attack
class BaseProxy < SimpleDelegator
class << self
def proxies
@@proxies ||= []
end
def inherited(klass)
super
proxies << klass
end
def lookup(store)
proxies.find { |proxy| proxy.handle?(store) }
end
def handle?(_store)
raise NotImplementedError
end
end
end
end
end