aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2011-08-15 16:56:33 -0500
committerDavid Heinemeier Hansson <david@loudthinking.com>2011-08-15 16:56:33 -0500
commit9482554f31f3ac7f941e6239890c60fcc01975e1 (patch)
tree979375ea99b948c31368bbc15bcd245eadd11488 /activesupport/lib
parentbb4e790dff3b345b4080263eb0b17da172b6e67f (diff)
downloadrails-9482554f31f3ac7f941e6239890c60fcc01975e1.tar.gz
rails-9482554f31f3ac7f941e6239890c60fcc01975e1.tar.bz2
rails-9482554f31f3ac7f941e6239890c60fcc01975e1.zip
Added Array#prepend as an alias for Array#unshift and Array#append as an alias for Array#<< [DHH]
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/core_ext/array.rb1
-rw-r--r--activesupport/lib/active_support/core_ext/array/prepend_and_append.rb7
2 files changed, 8 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/array.rb b/activesupport/lib/active_support/core_ext/array.rb
index 4688468a8f..268c9bed4c 100644
--- a/activesupport/lib/active_support/core_ext/array.rb
+++ b/activesupport/lib/active_support/core_ext/array.rb
@@ -5,3 +5,4 @@ require 'active_support/core_ext/array/conversions'
require 'active_support/core_ext/array/extract_options'
require 'active_support/core_ext/array/grouping'
require 'active_support/core_ext/array/random_access'
+require 'active_support/core_ext/array/prepend_and_append'
diff --git a/activesupport/lib/active_support/core_ext/array/prepend_and_append.rb b/activesupport/lib/active_support/core_ext/array/prepend_and_append.rb
new file mode 100644
index 0000000000..27718f19d4
--- /dev/null
+++ b/activesupport/lib/active_support/core_ext/array/prepend_and_append.rb
@@ -0,0 +1,7 @@
+class Array
+ # The human way of thinking about adding stuff to the end of a list is with append
+ alias_method :append, :<<
+
+ # The human way of thinking about adding stuff to the beginning of a list is with prepend
+ alias_method :prepend, :unshift
+end \ No newline at end of file