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.

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