aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext
diff options
context:
space:
mode:
authorJared McFarland <jared.online@gmail.com>2011-04-27 06:48:53 +0800
committerDavid Heinemeier Hansson <david@loudthinking.com>2011-04-27 20:51:39 +0800
commitd56befbd318967e28b44d17ba4d64f770030107e (patch)
treec7a2a3b4acf0d88b5b25da2bb64ecb6c752947a4 /activesupport/lib/active_support/core_ext
parentbd2444d1a887b310489a0e562d65dca309c1a141 (diff)
downloadrails-d56befbd318967e28b44d17ba4d64f770030107e.tar.gz
rails-d56befbd318967e28b44d17ba4d64f770030107e.tar.bz2
rails-d56befbd318967e28b44d17ba4d64f770030107e.zip
using @tenderlove's suggested implementation to speed things up
Diffstat (limited to 'activesupport/lib/active_support/core_ext')
-rw-r--r--activesupport/lib/active_support/core_ext/array/access.rb2
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+.