diff options
author | Jared McFarland <jared.online@gmail.com> | 2011-04-27 06:48:53 +0800 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2011-04-27 20:51:39 +0800 |
commit | d56befbd318967e28b44d17ba4d64f770030107e (patch) | |
tree | c7a2a3b4acf0d88b5b25da2bb64ecb6c752947a4 /activesupport | |
parent | bd2444d1a887b310489a0e562d65dca309c1a141 (diff) | |
download | rails-d56befbd318967e28b44d17ba4d64f770030107e.tar.gz rails-d56befbd318967e28b44d17ba4d64f770030107e.tar.bz2 rails-d56befbd318967e28b44d17ba4d64f770030107e.zip |
using @tenderlove's suggested implementation to speed things up
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/core_ext/array/access.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/array/access.rb b/activesupport/lib/active_support/core_ext/array/access.rb index a2086fa3e5..2bba0974b3 100644 --- a/activesupport/lib/active_support/core_ext/array/access.rb +++ b/activesupport/lib/active_support/core_ext/array/access.rb @@ -6,7 +6,7 @@ class Array # %w( a b c d ).from(10) # => %w() # %w().from(0) # => %w() def from(position) - position > length ? [] : self[position..-1] + [position, length] || [] end # Returns the beginning of the array up to +position+. |