diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2007-09-15 22:56:25 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2007-09-15 22:56:25 +0000 |
commit | c30c1808c0da2bfd34baf613fd8e1a4b685e8d94 (patch) | |
tree | 25138de3e726ec1cf07fd05b197b10ac3b9480c9 /activesupport/lib/active_support/core_ext/array/random_access.rb | |
parent | 694f15758c5af88f6d288d72650e2fcd2cfccfe7 (diff) | |
download | rails-c30c1808c0da2bfd34baf613fd8e1a4b685e8d94.tar.gz rails-c30c1808c0da2bfd34baf613fd8e1a4b685e8d94.tar.bz2 rails-c30c1808c0da2bfd34baf613fd8e1a4b685e8d94.zip |
Missing file from previous patch
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7490 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib/active_support/core_ext/array/random_access.rb')
-rw-r--r-- | activesupport/lib/active_support/core_ext/array/random_access.rb | 12 |
1 files changed, 12 insertions, 0 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 new file mode 100644 index 0000000000..b7ee00742a --- /dev/null +++ b/activesupport/lib/active_support/core_ext/array/random_access.rb @@ -0,0 +1,12 @@ +module ActiveSupport #:nodoc: + module CoreExtensions #:nodoc: + module Array #:nodoc: + module RandomAccess + # Return a random element from the array. + def rand + self[Kernel.rand(length)] + end + end + end + end +end |