1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #28638 from bogdanvlviv/prepend_and_append_in_ruby

Prevent aliases Array#append and Array#prepend
This commit is contained in:
Kasper Timm Hansen 2017-04-15 16:13:05 +02:00 committed by GitHub
commit 1e0d8425f6

View file

@ -1,7 +1,7 @@
class Array
# The human way of thinking about adding stuff to the end of a list is with append.
alias_method :append, :<<
alias_method :append, :push unless [].respond_to?(:append)
# The human way of thinking about adding stuff to the beginning of a list is with prepend.
alias_method :prepend, :unshift
alias_method :prepend, :unshift unless [].respond_to?(:prepend)
end