Trans
9/22/2008 7:41:00 PM
On Sep 22, 3:03=A0pm, "Michael Guterl" <mgut...@gmail.com> wrote:
> On Mon, Sep 22, 2008 at 1:40 PM, Trans <transf...@gmail.com> wrote:
> > Oh crud,
>
> > =A0class A
> > =A0 =A0def initialize
> > =A0 =A0 =A0@b =3D B.new
> > =A0 =A0end
> > =A0 =A0def method_missing(s, *a, &b)
> > =A0 =A0 =A0@b.__send__(s,*a,&b)
> > =A0 =A0end
> > =A0end
>
> > =A0class B
> > =A0 =A0def method_missing(s,*a,&b)
> > =A0 =A0 =A0"HERE"
> > =A0 =A0end
> > =A0end
>
> > =A0A.new.foo
>
> > How to get "HERE"?
>
> Works for me.
>
> I just had to `puts A.new.foo`
My bad, I mistook my trouble for this issue. But actually the trouble
only arises when:
class B
def method_missing(s,*a,&b)
"HERE"
end
private
def foo; 'foo'; end
end
Because method_missing applies to public calls and ignores private
ones.
T.