Assigning nil constant Foo does not affect the created class. It still exists, although you can no longer reference it with Foo (unless you reassign the class object to Foo again).
class Foo; end Foo.object_id
Regarding name , creating a class with
class Foo; end Foo.name
assigns it to constant Foo , like:
Foo = Class.new Foo.name # => "Foo"
It also sets its name , but that does not make it a class. You can also create classes without a name:
foo = Class.new foo.name
Assigning an unnamed class to a constant sets its name:
Bar = foo foo.name # => "Bar"
After installation, it does not change:
Baz = foo foo.name # => "Bar"
source share