How does the class name magic with Class.new?
John Carter <[email protected]> Mon, 10 Jun 2019 15:49:59 +1200
| Newsgroups | gmane.comp.lang.ruby.general |
|---|---|
| Message-ID | <CAFD1m3Ev2NmLjQJ3CDwCubp0eOZDBFzCkoYVudyHTHhmEis3HQ@mail.gmail.com> |
This seems like deep magic... Any idea how it works? a = Class.new => #<Class:0x0000558d34f68b48> > a.name => nil > B= a => B > a.name => "B" > C= a => B > C.name => "B" It seems as if whenever you create a Constant it checks to see to see if it is an unnamed class and then names it.... That seems..... too magic. -- John Carter Phone : (64)(3) 358 6639 Tait Electronics PO Box 1645 Christchurch New Zealand -- This Communication is Confidential. We only send and receive email on the basis of the terms set out at www.taitradio.com/email_disclaimer <http://www.taitradio.com/email_disclaimer> Unsubscribe: <mailto:[email protected]?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>