inspect is a method that, by default, tells you the class name, the object_id instance, and lists the instance variables.
print and puts are used, as you already know, to set the value of the to_s method of an STDOUT object. As stated in the Ruby documentation, Object#to_s returns a string representing the object used for readability by the end user.
print and puts identical to each other, except puts automatically adds a new line, but print does not.
Mark Rushakoff Apr 12 '10 at 21:45 2010-04-12 21:45
source share