Oh crud,
class A
def initialize
@b = B.new
end
def method_missing(s, *a, &b)
@b.send(s,*a,&b)
end
end
class B
def method_missing(s,*a,&b)
“HERE”
end
end
A.new.foo
How to get “HERE”?
Oh crud,
class A
def initialize
@b = B.new
end
def method_missing(s, *a, &b)
@b.send(s,*a,&b)
end
end
class B
def method_missing(s,*a,&b)
“HERE”
end
end
A.new.foo
How to get “HERE”?
On Mon, Sep 22, 2008 at 1:40 PM, Trans [email protected] wrote:
Works for me.
I just had to puts A.new.foo
On Sep 22, 3:03 pm, “Michael G.” [email protected] wrote:
end
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.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs