style: avoid multiple assignments to same variable in conditional

This commit is contained in:
Gonzalo Rodriguez 2019-08-02 11:59:15 -03:00
parent c8021da91c
commit d508e21483
No known key found for this signature in database
GPG key ID: 5DB8B81B049B8AB1
2 changed files with 9 additions and 5 deletions

View file

@ -46,6 +46,9 @@ Style/ClassAndModuleChildren:
Exclude: Exclude:
- "spec/**/*" - "spec/**/*"
Style/ConditionalAssignment:
Enabled: true
Style/Encoding: Style/Encoding:
Enabled: true Enabled: true

View file

@ -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