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"]
Show source
Register or log in to add new notes.
February 11, 2010 - (v1_8_6_287 - v1_8_7_72)
1 thank

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'))