Is there a way to do this without splat so that it is less confusing?
Since it a,b = [c,d]matches a,b = *[c,d]and splat calls to_aon its operand when it is not an array, you can just call to_a explicitly and not need a sign:
match, text, number = "foobar 123".match(/([A-z]*) ([0-9]*)/).to_a
I do not know if it is not less confusing, but it is free.
source
share