aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorBrian Christian <brchristian@gmail.com>2016-02-10 10:10:38 -0800
committerBrian Christian <brchristian@gmail.com>2016-02-10 10:10:38 -0800
commite8aeda2ab39b5d416a72edfa74e0fb17721eb6f9 (patch)
treeea2b76a40f9d9ce3046a9fae3f177b9e4c0b1706 /activesupport
parentc74045cf0771ab51dfeca94b30c447cab6193e60 (diff)
downloadrails-e8aeda2ab39b5d416a72edfa74e0fb17721eb6f9.tar.gz
rails-e8aeda2ab39b5d416a72edfa74e0fb17721eb6f9.tar.bz2
rails-e8aeda2ab39b5d416a72edfa74e0fb17721eb6f9.zip
rename to 'second_to_last' and 'third_to_last'
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/core_ext/array/access.rb8
-rw-r--r--activesupport/test/core_ext/array/access_test.rb4
2 files changed, 6 insertions, 6 deletions
diff --git a/activesupport/lib/active_support/core_ext/array/access.rb b/activesupport/lib/active_support/core_ext/array/access.rb
index e413acddc5..37d833887a 100644
--- a/activesupport/lib/active_support/core_ext/array/access.rb
+++ b/activesupport/lib/active_support/core_ext/array/access.rb
@@ -76,15 +76,15 @@ class Array
# Equal to <tt>self[-3]</tt>.
#
- # %w( a b c d e ).antepenultimate # => "c"
- def antepenultimate
+ # %w( a b c d e ).third_to_last # => "c"
+ def third_to_last
self[-3]
end
# Equal to <tt>self[-2]</tt>.
#
- # %w( a b c d e ).penultimate # => "d"
- def penultimate
+ # %w( a b c d e ).second_to_last # => "d"
+ def second_to_last
self[-2]
end
end
diff --git a/activesupport/test/core_ext/array/access_test.rb b/activesupport/test/core_ext/array/access_test.rb
index d7a3fb56c2..1d834667f0 100644
--- a/activesupport/test/core_ext/array/access_test.rb
+++ b/activesupport/test/core_ext/array/access_test.rb
@@ -26,8 +26,8 @@ class AccessTest < ActiveSupport::TestCase
assert_equal array[3], array.fourth
assert_equal array[4], array.fifth
assert_equal array[41], array.forty_two
- assert_equal array[-3], array.antepenultimate
- assert_equal array[-2], array.penultimate
+ assert_equal array[-3], array.third_to_last
+ assert_equal array[-2], array.second_to_last
end
def test_without