The backslash is used to escape special characters. In your case to
encode a single quote in the string rather than terminating the string
IRB is behaving funny because it thinks the string is incomplete, it is
looking for a closing single quote.
The double-backslash encodes as a single backslash in the string.