On Thu, 30 Sep 2004, trans. (T. Onoma) wrote: > On Wednesday 29 September 2004 05:24 am, Robert Klemme wrote: >>>> A::B() >> >> NoMethodError: undefined method `B' for A:Module >> from (irb):7 >> >>>> include A >> >> => Object >> >>>> B() >> >> NoMethodError: undefined method `B' for main:Object >> from (irb):9 >> > > I was waiting for this ;) See if you can break this one. harp:~ > cat c.rb class Object def const_get(c) self.class.const_get(c) end def const_set(c,v) self.class.const_set(c,v) end end module Kernel alias method_missing_orig method_missing def method_missing(m,*a,&b) Class === (c = const_get(m)) ? c::new(*a,&b) : method_missing_orig(m,*a,&b) end end require 'singleton' class C; include Singleton; end C() harp:~ > ruby c.rb c.rb:12:in `const_get': wrong constant name new (NameError) from c.rb:12:in `method_missing' from c.rb:12:in `method_missing' from c.rb:17 tho that may not be fair. cheers. -a -- =============================================================================== | EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov | PHONE :: 303.497.6469 | A flower falls, even though we love it; | and a weed grows, even though we do not love it. | --Dogen ===============================================================================