I am trying to receive a string of characters and change all characters aside from spaces to "*". Here is where I am:
def change_word(word)
new_word.each {|replace| replace.gsub!(/./, "*") }
new_word.to_s
new_word.join
end
I'm taking a word, adding the individual characters to an array and assigning this to a new variable, replacing everything in said array with the required symbol, changing everything in the array to a string and then joining everything in the array to output a bunch of *'s.
What I would like to do (and it's not necessary that the solution follows the previous syntax) is take all letters and replace them with *. Spaces should stay as a space, only letters should become *.