I have two arrays
default = ['0', '0', '0', '0'] # this is fixed
new = ['2', '3', ''] # it can be of many variants like ['', '1'] or
# ['1', '', '', ''], but will never have
# more than 4 elements
I want to get a resultant array from above two arrays as
['2', '3', '0', '0']
How to achieve it one line of simple ruby code? I can do it in multiple line or with the help of inject/reduce.
1 Answer