From d56befbd318967e28b44d17ba4d64f770030107e Mon Sep 17 00:00:00 2001 From: Jared McFarland Date: Wed, 27 Apr 2011 06:48:53 +0800 Subject: using @tenderlove's suggested implementation to speed things up --- activesupport/lib/active_support/core_ext/array/access.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/lib/active_support/core_ext/array') 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+. -- cgit v1.2.3