aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorSantosh Wadghule <santosh.wadghule@gmail.com>2015-01-16 22:44:45 +0530
committerSantosh Wadghule <santosh.wadghule@gmail.com>2015-01-16 22:44:45 +0530
commit62fd46ad6340f15a33d47d4182013c5ca42835e0 (patch)
tree51f7f73e4bb5b5e65cb4392a39af0f023f16f996 /activesupport/lib
parent090c5211ced7b728df6176d5c9fc7437c107beaf (diff)
downloadrails-62fd46ad6340f15a33d47d4182013c5ca42835e0.tar.gz
rails-62fd46ad6340f15a33d47d4182013c5ca42835e0.tar.bz2
rails-62fd46ad6340f15a33d47d4182013c5ca42835e0.zip
A little performance improvement using 'take' method over 'first'
Diffstat (limited to 'activesupport/lib')
-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 45b89d2705..ca66d806ef 100644
--- a/activesupport/lib/active_support/core_ext/array/access.rb
+++ b/activesupport/lib/active_support/core_ext/array/access.rb
@@ -21,7 +21,7 @@ class Array
# %w( a b c ).to(-10) # => []
def to(position)
if position >= 0
- first position + 1
+ take position + 1
else
self[0..position]
end