diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2011-08-15 16:56:33 -0500 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2011-08-15 16:56:33 -0500 |
commit | 9482554f31f3ac7f941e6239890c60fcc01975e1 (patch) | |
tree | 979375ea99b948c31368bbc15bcd245eadd11488 /activesupport/lib/active_support/core_ext/array/prepend_and_append.rb | |
parent | bb4e790dff3b345b4080263eb0b17da172b6e67f (diff) | |
download | rails-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/active_support/core_ext/array/prepend_and_append.rb')
-rw-r--r-- | activesupport/lib/active_support/core_ext/array/prepend_and_append.rb | 7 |
1 files changed, 7 insertions, 0 deletions
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 |