Ruby concatenate strings and add spaces
You can use inject:
[name,quest,favorite_color,speed].inject("") {|k,v| v.empty? ? k : k << " " << v }.strip
You can use inject:
[name,quest,favorite_color,speed].inject("") {|k,v| v.empty? ? k : k << " " << v }.strip