From e117bb943ad42c7f18f39432b73cd399894a93cd Mon Sep 17 00:00:00 2001 From: Rizwan Reza Date: Mon, 17 May 2010 01:55:56 +0430 Subject: [PATCH] Removed Array#rand --- .../active_support/core_ext/array/random_access.rb | 12 +----------- activesupport/test/core_ext/array_ext_test.rb | 4 ---- 2 files changed, 1 insertions(+), 15 deletions(-) diff --git a/activesupport/lib/active_support/core_ext/array/random_access.rb b/activesupport/lib/active_support/core_ext/array/random_access.rb index 5338836..67c322d 100644 --- a/activesupport/lib/active_support/core_ext/array/random_access.rb +++ b/activesupport/lib/active_support/core_ext/array/random_access.rb @@ -1,16 +1,6 @@ class Array - # This method is deprecated because it masks Kernel#rand within the Array class itself, - # which may be used by a 3rd party library extending Array in turn. See - # - # https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/4555 - # - def rand # :nodoc: - ActiveSupport::Deprecation.warn "Array#rand is deprecated, use random_element instead", caller - random_element - end - # Returns a random element from the array. def random_element self[Kernel.rand(length)] end -end +end \ No newline at end of file diff --git a/activesupport/test/core_ext/array_ext_test.rb b/activesupport/test/core_ext/array_ext_test.rb index ebd6806..1f7cdb8 100644 --- a/activesupport/test/core_ext/array_ext_test.rb +++ b/activesupport/test/core_ext/array_ext_test.rb @@ -368,10 +368,6 @@ class ArrayExtRandomTests < ActiveSupport::TestCase Kernel.expects(:rand).with(3).returns(1) assert_equal 2, [1, 2, 3].random_element end - - def test_deprecated_rand_on_array - assert_deprecated { [].rand } - end end class ArrayWrapperTests < Test::Unit::TestCase -- 1.6.5.2