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:
commit
1e0d8425f6
1 changed files with 2 additions and 2 deletions
|
@ -1,7 +1,7 @@
|
||||||
class Array
|
class Array
|
||||||
# The human way of thinking about adding stuff to the end of a list is with append.
|
# 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.
|
# 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
|
end
|
||||||
|
|
Loading…
Reference in a new issue