From: ara.t.howard@... Date: 2007-02-14T05:56:09+09:00 Subject: Re: Dynamically determining a class' namespace On Wed, 14 Feb 2007, Daniel Berger wrote: > Hi all, > > Ruby 1.8.x > > Is there a way to determine a classes namespace from within an > instance method? > > class Foo > def initialize > # print namespace > end > end > > Foo.new # 'Object'? 'Kernel'? nil? > > module Bar > Foo.new # 'Bar' > end > > module Baz > module Bar > Foo.new # 'Baz::Bar' > end > end > > If not, is it possible at the class level? I looked at Module#nesting > and Module#name, but I couldn't see how to use those to get what I > want. > > Thanks, > > Dan > > http://groups.google.com/group/comp.lang.ruby/browse_frm/thread/964c11aefa515b29/c1fb423d3dcda20e?lnk=gst&q=a.rb+nesting&rnum=2&hl=en#c1fb423d3dcda20e -a -- we can deny everything, except that we have the possibility of being better. simply reflect on that. - the dalai lama