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:
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user