1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

avoid creating range objects

This commit is contained in:
Aaron Patterson 2011-05-29 13:37:42 -07:00
parent eb3f81f9dc
commit 96525d632d

View file

@ -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 <tt>self[1]</tt>.