mirror of
https://github.com/samsonjs/rack-attack.git
synced 2026-04-27 15:07:41 +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:
|
Exclude:
|
||||||
- "spec/**/*"
|
- "spec/**/*"
|
||||||
|
|
||||||
|
Style/ConditionalAssignment:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
Style/Encoding:
|
Style/Encoding:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,11 @@ module Rack
|
||||||
def initialize(name, options = {}, &block)
|
def initialize(name, options = {}, &block)
|
||||||
options[:type] = :track
|
options[:type] = :track
|
||||||
|
|
||||||
|
@filter =
|
||||||
if options[:limit] && options[:period]
|
if options[:limit] && options[:period]
|
||||||
@filter = Throttle.new(name, options, &block)
|
Throttle.new(name, options, &block)
|
||||||
else
|
else
|
||||||
@filter = Check.new(name, options, &block)
|
Check.new(name, options, &block)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue