From d123297ba6c7f09629274776f0f4fcba783d6776 Mon Sep 17 00:00:00 2001 From: taitus Date: Fri, 13 Jun 2025 12:28:54 +0200 Subject: [PATCH] Add and apply Style/ComparableBetween RuboCop rule This rule was introduced in RuboCop 1.74 to prefer using between? over chained comparison operators. --- .rubocop.yml | 3 +++ app/models/poll.rb | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.rubocop.yml b/.rubocop.yml index 2007b91dc..dc61db8c8 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -725,6 +725,9 @@ Style/ClassVars: Style/CollectionMethods: Enabled: true +Style/ComparableBetween: + Enabled: true + Style/DigChain: Enabled: true diff --git a/app/models/poll.rb b/app/models/poll.rb index 8b6ec8624..68c15face 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -116,7 +116,7 @@ class Poll < ApplicationRecord end def current?(timestamp = Time.current) - starts_at <= timestamp && timestamp <= ends_at + timestamp.between?(starts_at, ends_at) end def expired?(timestamp = Time.current)