From: Daniel Schierbeck Date: 2006-06-22T22:10:23+09:00 Subject: Re: Module#name for anonymous modules Yukihiro Matsumoto wrote: > Hi, > > In message "Re: Module#name for anonymous modules" > on Thu, 22 Jun 2006 08:08:20 +0900, transfire@gmail.com writes: > > |Observation: > | > | mod = Module.new > | mod.name #=> "" > | > |Maybe it would more friendly if Module#name returned nil in this case? > |Then one could more easily say: > | > | if mod.name > | ... > | end > > OK. It will be for 1.9 or later. Hmm, I think it may be too indirect. You aren't really checking whether the module has a name or not, but rather if it's anonymous. Maybe an #anonymous? method for both Module and Class, in addition to #name being nil? Cheers, Daniel