HI --

On Fri, 28 May 2004, Sean O'Dell wrote:

> On Thursday 27 May 2004 16:37, Sean O'Dell wrote:
> > How do you call a global method from a module method where there is another
> > module method that shares the name of the global method?
> 
> Perhaps that was too cryptic.  Here's an example:
> 
> def test
>   p "in first test"
> end
> 
> module somemodule
>   def somemodule::somemethod
>     test()
>   end
> 
>   def somemodule::test
>     p "in somemodule::test"
>   end
> end
> 
> 
> In somemodule::somemethod, I intended to call the global test method, but I 
> ended up calling somemodule::test.
> 
> How do you call the outer global method in a case like this?

I'm not sure this is the slickest way... but you could do:

  def m
    1
  end
  public :m

  class C
    def C.m
      2
    end

    def C.n
      Object.m   # or [].m or "hi".m, for that matter :-)
    end
  end

  p C.n    # 1


David

-- 
David A. Black
dblack / wobblini.net