I need a method which returns a merged array starting a specified index. I've looked here, here and here without cracking it.
I can see that this concatenates but I want to update the array not simply combine them:
@a1 = [0,0,0,0,0]
a2 = [1,1]
def update_array(new_array)
@a1.push(*new_array)
end
update_array(a2)
I'd like the output to be something like:
#[0,1,1,0,0] or [0,0,0,1,1]
Depending on the index specified.