In Ruby, the inspect string method is used to return a printable version of a string that is surrounded by quotes. If there are any special characters present in the string, they will be escaped.
str.inspect
str: The string that we want to inspect.This method returns a string that is surrounded by quotation marks.
# create stringsstr1 = "Edpresso"str2 = "is"str3 = "awesome"# inspect stringsa = str1.inspectb = str2.inspectc = str3.inspect# print resultsputs aputs bputs c
inspect method on the strings that we created and store the results in the variables a, b, and c.