I want to have a user type some words, and get them converted to an array. I want to split by word. Here is an example:
"15 17 21 46" → [15, 17, 21, 46]
Stuff like split("") and scan make an array out of every single letter.
I would prefer doing it without using YAML. Also, take note in the example that it doesn't include the spaces but it uses those as breaks between values.
Is it possible to do what I did in the example above where I have a bunch of numbers with spaces and those get converted directly to integers? I feel like the spaces might interrupt it in case I do something like to_i.
This question is similar to String to Array in Ruby, but it does not have an answer.