
Issue #19450 has been updated by ioquatix (Samuel Williams). Status changed from Open to Closed Thanks for all the discussion, here are the proposals: - https://bugs.ruby-lang.org/issues/19520 (parameter to new) - https://bugs.ruby-lang.org/issues/19521 (Module#name=) They are alternatives and also complementary, i.e. we could do both. ---------------------------------------- Feature #19450: Is there an official way to set a class name without setting a constant? https://bugs.ruby-lang.org/issues/19450#change-102268 * Author: ioquatix (Samuel Williams) * Status: Closed * 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? What about something like: ```ruby Class.new(name: "Klass") ``` or ```ruby Class.new do def self.name "Klass" end end ``` etc -- https://bugs.ruby-lang.org/