aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/array/prepend_and_append.rb
blob: 661971d7cd59e137d5b3332b35bc90fe28d883da (plain) (blame)
1
2
3
4
5
6
7
8
9
# frozen_string_literal: true

class Array
  # The human way of thinking about adding stuff to the end of a list is with 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 unless [].respond_to?(:prepend)
end