Only intercept when string is composed of numbers

This commit is contained in:
Jorge Manrubia
2025-06-26 09:37:22 +02:00
parent cd4e6c75d7
commit 274a6ad9d5
+3 -2
View File
@@ -89,8 +89,9 @@ class Command::Parser
end
def multiple_cards_from(string)
if tokens = string.split(/[\s,]+/).filter { it =~ /\A\d+\z/ }.presence
user.accessible_cards.where(id: tokens).presence if tokens.many?
if string.match?(/^[\d\s,]+$/)
tokens = string.split(/[\s,]+/)
user.accessible_cards.where(id: tokens).presence if tokens&.many?
end
end