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:
- "spec/**/*"
Style/ConditionalAssignment:
Enabled: true
Style/Encoding:
Enabled: true

View file

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