Here are a few other ways to return asans elements to> = indexes index, which are probably better expressed as "returning the first elements index". All below come back ["a", "b"]).
a = ["a", "b", "c", "d", "e"]
index = 2
(.. a )
a[0,index]
index.times.map { |i| a[i] }
(a "" )
a.object_id
a = a[0,index]
a.object_id
a.object_id
a.replace(a.first(index))
a.object_id