class IndexError inherits Exception ¶ Raised when the given index is invalid. a = [:foo, :bar] a[2] # raises IndexError Class methods¶ .new(message = "Index out of bounds") ¶ View source