Skip to content

Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →

instance method

Object#to_s

() -> ::String
obj.to_s → string

Returns a string representing obj. The default to_s prints the object’s class and an encoding of the object id. As a special case, the top-level object that is the initial execution context of Ruby programs returns “main”.

See also #to_enum #to_yaml #singleton_methods #xmp also in 4.1 · 4.0 · 3.3 · 3.2 · 3.1 · 3.0