When you didn't close your single-quoted string, irb
started treating everything following (including the close-array ]
) as part of that string.
To get back to a prompt that works, you either need to
- Close the string and the array - that is, match the
'
and then the]
; or - Press Ctrl-C, which drops you out of your context
See that the last digit in the prompt changes to 1
after your malformed string, and back to 0
after Ctrl-C? That's the nesting depth. If it's at 0, you're back in the main context of itb.