method
unshift
v1_8_6_287 -
Show latest stable
- Class:
Array
unshift(...)public
Prepends objects to the front of array. other elements up one.
a = [ "b", "c", "d" ] a.unshift("a") #=> ["a", "b", "c", "d"] a.unshift(1, 2) #=> [ 1, 2, "a", "b", "c", "d"]
1Note
Using Unshift with Load Path's
Using unshift on your load path's for Rails, Sinatra, etc, is a good way of ensuring that the file your including is going to be first.
== Example vendor = File.join(File.dirname(FILE), 'vendor') $LOAD_PATH.unshift File.expand_path(File.join(vendor, 'ultraviolet-0.10.5', 'lib'))