method
unshift
v2_4_6 -
Show latest stable
- Class:
Array
unshift(*args)public
Prepends objects to the front of self, moving other elements upwards. See also Array#shift for the opposite effect.
a = [ "b", "c", "d" ] a.unshift("a") #=> ["a", "b", "c", "d"] a.unshift(1, 2) #=> [ 1, 2, "a", "b", "c", "d"]