mirror of
https://github.com/samsonjs/rack-attack.git
synced 2026-03-25 09:25:49 +00:00
21 lines
419 B
Ruby
21 lines
419 B
Ruby
module Rack
|
|
class Attack
|
|
class Track
|
|
extend Forwardable
|
|
|
|
attr_reader :filter
|
|
|
|
def initialize(name, options = {}, block)
|
|
options[:type] = :track
|
|
|
|
if options[:limit] && options[:period]
|
|
@filter = Throttle.new(name, options, block)
|
|
else
|
|
@filter = Check.new(name, options, block)
|
|
end
|
|
end
|
|
|
|
def_delegator :@filter, :[]
|
|
end
|
|
end
|
|
end
|