
20 Feb
2023
20 Feb
'23
1:04 a.m.
Issue #19450 has been reported by ioquatix (Samuel Williams). ---------------------------------------- Feature #19450: Is there an official way to set a class name without setting a constant? https://bugs.ruby-lang.org/issues/19450 * Author: ioquatix (Samuel Williams) * Status: Open * Priority: Normal ---------------------------------------- This is the best I could come up with: ```ruby klass = Class.new Object.const_set("Klass", klass) Object.send(:remove_const, "Klass") puts klass.new # => #<Klass:0x0000000100a9d688> ``` Can we do better? -- https://bugs.ruby-lang.org/