Suggestions for Ruby string parsing
Here's the "naïve" way to go

"this is a test".split.map { |word| "\"#{word}\"" }.join(" ")


But a better way is to use a regular expression, since those are made specifically for string manipulation/substitution

"this is a test".gsub(/\S+/, '"\0"')


The expression matches 1 or more (the +) non-whitespace characters (the \S) in a row, and replaces the match with the same string (the \0) but surrounded by quotes.