Gavin
This behavior is (finally) documented in the development version
of Ruby (since 2 days!).
For ary[index], ary[start, length], ary[range], …:
“Element Reference — Returns the element at +index+, or returns a
subarray starting at the +start+ index and continuing for +length+
elements, or returns a subarray specified by +range+ of indices.”
“Negative indices count backward from the end of the array (-1 is
the last element). For +start+ and +range+ cases the starting index
is just before an element. Additionally, an empty array is returned
when the starting index for an element range is at the end of
the array.”
“Returns +nil+ if the index (or starting index) are out of range.”
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.