Ruby Array slice shortcut
Today I learned that Ruby has an alias for Array slice method, basically you can use the []
the same way you'd use the slice
method:
array = [ "a", "b", "c", "d", "e" ]
array[3..5]
# => ["d", "e"]
array.slice(3..5)
# => ["d", "e"]
Tweet