Если вы посмотрите на документы по Ruby, вы узнаете все виды странных вещей. Но этот синтаксис является просто подстрокой и смещением, поэтому, если вы просто запустите irb и немного потрудитесь, вы получите
>> "123456789"[3,2]
=> "45"
чтобы вы могли видеть, что происходит. В любом случае, документы здесь
str.index(substring [, offset]) => fixnum or nil
str.index(fixnum [, offset]) => fixnum or nil
str.index(regexp [, offset]) => fixnum or nil
Returns the index of the first occurrence of the given substring, character (fixnum), or pattern (regexp) in str. Returns nil if not found. If the second parameter is present, it specifies the position in the string to begin the search.
"hello".index('e') #=> 1
"hello".index('lo') #=> 3
"hello".index('a') #=> nil
"hello".index(101) #=> 1
"hello".index(/[aeiou]/, -3) #=> 4