Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby objects without 'to_s' [closed]

Tags:

ruby

Are there any objects in ruby that don't respond to to_s?

The question isn't meant to ask whether it is possible to create one, which I know can be done by undef_method. Feel free to explain details, including caveats of undefining.

like image 342
Matthias Michael Engh Avatar asked Apr 19 '26 13:04

Matthias Michael Engh


1 Answers

The BasicObject class does not define a to_s method, so any instance of that class would not have a to_s method.

like image 170
sepp2k Avatar answered Apr 21 '26 03:04

sepp2k