Better method for string concatenation

Never developed in Ruby before. I have only just discovered that apparently `<<` is a better method of string concatenation.
This commit is contained in:
Jonathan 2016-06-16 11:59:11 +01:00 committed by GitHub
parent 2720ed3d2c
commit d1be7ae84a
1 changed files with 1 additions and 1 deletions

View File

@ -4,7 +4,7 @@ module VagrantPlugins
class InsertPublicKey class InsertPublicKey
def self.insert_public_key(machine, contents) def self.insert_public_key(machine, contents)
comm = machine.communicate comm = machine.communicate
contents = contents.chomp+"\n" contents = contents.chomp << "\n"
remote_path = "/tmp/vagrant-authorized-keys-#{Time.now.to_i}" remote_path = "/tmp/vagrant-authorized-keys-#{Time.now.to_i}"
Tempfile.open("vagrant-linux-insert-public-key") do |f| Tempfile.open("vagrant-linux-insert-public-key") do |f|