I have the following which works well:
def steps
%w[hello billing confirmation]
end
steps.first
But I want to do this:
d
%w[hello billing confirmation]
is syntax sugar for ["hello", "billing", "confirmation"]
. It tells Ruby to break up the input string into words, based on the whitespace, and to return an array of the words.
If your specific use case means the values in the array are permitted to have spaces, you cannot use %w
.
In your case, ['Upload a photo', 'Billing Info', 'Confirmation Screen']
suffices.