using @tenderlove's suggested implementation to speed things up
This commit is contained in:
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+.
|
||||
|
Loading…
Reference in New Issue
Block a user