Ruby defines #clone
in Object.
To my suprise, some classes raise Exceptions when calling it.
I found NilClass, TrueCla
I did a git grep "can't clone"
of YARV's source code, and got
lib/singleton.rb: raise TypeError, "can't clone instance of singleton #{self.class}"
object.c: rb_raise(rb_eTypeError, "can't clone %s", rb_obj_classname(obj));
test/test_singleton.rb: expected = "can't clone instance of singleton TestSingleton::SingletonTest"
The first and third lines indicate you can't clone a singleton.
The second line refers to rb_special_const_p(obj)
. But this is going beyond my ken.