Replace conditional with presence

This commit is contained in:
Jorge Manrubia
2025-05-07 14:56:57 +02:00
parent 5e812b15ba
commit cfdf19db9d
+1 -4
View File
@@ -56,10 +56,7 @@ class Command::Parser
def multiple_cards_from(string)
if tokens = string.split(/[\s,]+/).filter { it =~ /\A\d+\z/ }.presence
if tokens.many?
cards = user.accessible_cards.where(id: tokens)
cards.any? ? cards : nil
end
user.accessible_cards.where(id: tokens).presence if tokens.many?
end
end