Add and apply Style/ComparableBetween RuboCop rule

This rule was introduced in RuboCop 1.74 to prefer using between?
over chained comparison operators.
This commit is contained in:
taitus
2025-06-13 12:28:54 +02:00
parent 123c97771a
commit d123297ba6
2 changed files with 4 additions and 1 deletions

View File

@@ -725,6 +725,9 @@ Style/ClassVars:
Style/CollectionMethods: Style/CollectionMethods:
Enabled: true Enabled: true
Style/ComparableBetween:
Enabled: true
Style/DigChain: Style/DigChain:
Enabled: true Enabled: true

View File

@@ -116,7 +116,7 @@ class Poll < ApplicationRecord
end end
def current?(timestamp = Time.current) def current?(timestamp = Time.current)
starts_at <= timestamp && timestamp <= ends_at timestamp.between?(starts_at, ends_at)
end end
def expired?(timestamp = Time.current) def expired?(timestamp = Time.current)