mirror of
https://github.com/samsonjs/rack-attack.git
synced 2026-03-25 09:25:49 +00:00
style: avoid multiple assignments to same variable in conditional
This commit is contained in:
parent
c8021da91c
commit
d508e21483
2 changed files with 9 additions and 5 deletions
|
|
@ -46,6 +46,9 @@ Style/ClassAndModuleChildren:
|
|||
Exclude:
|
||||
- "spec/**/*"
|
||||
|
||||
Style/ConditionalAssignment:
|
||||
Enabled: true
|
||||
|
||||
Style/Encoding:
|
||||
Enabled: true
|
||||
|
||||
|
|
|
|||
|
|
@ -8,11 +8,12 @@ module Rack
|
|||
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
|
||||
@filter =
|
||||
if options[:limit] && options[:period]
|
||||
Throttle.new(name, options, &block)
|
||||
else
|
||||
Check.new(name, options, &block)
|
||||
end
|
||||
end
|
||||
|
||||
def matched_by?(request)
|
||||
|
|
|
|||
Loading…
Reference in a new issue