From e31b98539cfe5813a7efd17a08559ecfcf5f1fe4 Mon Sep 17 00:00:00 2001 From: Matteo Giaccone Date: Fri, 22 Nov 2024 09:57:45 +0100 Subject: [PATCH] Avoid string mutation For Ruby 3.4 --- lib/kamal/commands/base.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/kamal/commands/base.rb b/lib/kamal/commands/base.rb index 8ef584ae..6d3f71ec 100644 --- a/lib/kamal/commands/base.rb +++ b/lib/kamal/commands/base.rb @@ -96,12 +96,13 @@ module Kamal::Commands end def ssh_keys_args - args = "" - config.ssh.keys&.each do |key| - args << " -i #{key}" + "#{ ssh_keys.join("") if ssh_keys}" + "#{" -o IdentitiesOnly=yes" if config.ssh&.keys_only}" + end + + def ssh_keys + config.ssh.keys&.map do |key| + " -i #{key}" end - args << " -o IdentitiesOnly=yes" if config.ssh&.keys_only - args end end end