From 96525d632d47847ae5a8d6658ad396b74ecfb6f1 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Sun, 29 May 2011 13:37:42 -0700 Subject: [PATCH] avoid creating range objects --- activesupport/lib/active_support/core_ext/array/access.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activesupport/lib/active_support/core_ext/array/access.rb b/activesupport/lib/active_support/core_ext/array/access.rb index 2df4fd1da1..6162f7af27 100644 --- a/activesupport/lib/active_support/core_ext/array/access.rb +++ b/activesupport/lib/active_support/core_ext/array/access.rb @@ -16,7 +16,7 @@ class Array # %w( a b c d ).to(10) # => %w( a b c d ) # %w().to(0) # => %w() def to(position) - self[0..position] + self.first position + 1 end # Equal to self[1].