using @tenderlove's suggested implementation to speed things up

This commit is contained in:
Jared McFarland 2011-04-27 06:48:53 +08:00 committed by David Heinemeier Hansson
parent bd2444d1a8
commit d56befbd31

@ -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+.