diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2015-01-17 10:45:43 -0200 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2015-01-17 10:45:43 -0200 |
commit | 0c24d352c9b31165a8d72338326f248218b5101f (patch) | |
tree | 0cb58d97df75fd9209672d7177de891672951761 /activesupport/lib | |
parent | 89eb1ae69b64197eccd0eae3a985184acbf4f9ac (diff) | |
parent | 62fd46ad6340f15a33d47d4182013c5ca42835e0 (diff) | |
download | rails-0c24d352c9b31165a8d72338326f248218b5101f.tar.gz rails-0c24d352c9b31165a8d72338326f248218b5101f.tar.bz2 rails-0c24d352c9b31165a8d72338326f248218b5101f.zip |
Merge pull request #18554 from mechanicles/use-take-method
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 |