diff options
author | Santosh Wadghule <santosh.wadghule@gmail.com> | 2015-01-16 22:44:45 +0530 |
---|---|---|
committer | Santosh Wadghule <santosh.wadghule@gmail.com> | 2015-01-16 22:44:45 +0530 |
commit | 62fd46ad6340f15a33d47d4182013c5ca42835e0 (patch) | |
tree | 51f7f73e4bb5b5e65cb4392a39af0f023f16f996 /activesupport/lib | |
parent | 090c5211ced7b728df6176d5c9fc7437c107beaf (diff) | |
download | rails-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.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 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 |