From: Brian Candler Date: 2003-02-20T23:06:55+09:00 Subject: Re: module This::Encompassing::That --azLHFNyN32YCQGCU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Feb 20, 2003 at 09:14:31PM +0900, nobu.nokada@softhome.net wrote: > Autoload affects only top level constants, even in module > definition. I suspected that you wanted the files to get > loaded by access to constants under Utils. Excuse my > misunderstanding. No, it is me who still misunderstands :-) I did: a = Utils::ClassA.new and it worked. Attached is a full example, which gives: $ ruby main.rb I am foo 99 I am bar 123 $ Regards, Brian. --azLHFNyN32YCQGCU Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="main.rb" #!/usr/local/bin/ruby -w module Utils autoload :ClassA, 'classa' autoload :ConstB, 'constb' autoload :ClassC, 'classc' autoload :ConstD, 'constd' end a = Utils::ClassA.new a.foo b = Utils::ConstB puts b module Utils c = ClassC.new c.bar d = ConstD puts d end --azLHFNyN32YCQGCU Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="classa.rb" class ClassA def foo puts "I am foo" end end --azLHFNyN32YCQGCU Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="constb.rb" ConstB = 99 --azLHFNyN32YCQGCU Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="classc.rb" class ClassC def bar puts "I am bar" end end --azLHFNyN32YCQGCU Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="constd.rb" ConstD = 123 --azLHFNyN32YCQGCU--