class Rack::Attack::Check
Attributes
block[R]
name[R]
type[R]
Public Class Methods
new(name, options = {}, &block)
click to toggle source
# File lib/rack/attack/check.rb, line 8 def initialize(name, options = {}, &block) @name = name @block = block @type = options.fetch(:type, nil) end
Public Instance Methods
matched_by?(request)
click to toggle source
# File lib/rack/attack/check.rb, line 14 def matched_by?(request) block.call(request).tap do |match| if match request.env["rack.attack.matched"] = name request.env["rack.attack.match_type"] = type Rack::Attack.instrument(request) end end end