From: ara.t.howard@... Date: 2005-12-07T01:25:26+09:00 Subject: Re: getting around access control On Tue, 6 Dec 2005, nobuyoshi nakada wrote: > Hi, > > At Tue, 6 Dec 2005 16:04:39 +0900, > Ara.T.Howard wrote in [ruby-talk:169057]: >> c.instance_eval{ p meth } >> >> this throws an error, of course, but i'm too tired to remember how to work >> around it. > > Hmmm, it seems to have changed unintentionally, together with > rb_funcall2(), at Dec 1. Should I fix it? > > > Index: eval.c > =================================================================== > RCS file: /cvs/ruby/src/ruby/eval.c,v > retrieving revision 1.616.2.135 > diff -U2 -p -u -r1.616.2.135 eval.c > --- eval.c 30 Nov 2005 15:51:05 -0000 1.616.2.135 > +++ eval.c 6 Dec 2005 08:46:32 -0000 > @@ -5901,11 +5901,11 @@ rb_call(klass, recv, mid, argc, argv, sc > } > > - if (mid != missing && scope == 0) { > + if (mid != missing) { > /* receiver specified form for private method */ > - if (noex & NOEX_PRIVATE) > + if ((noex & NOEX_PRIVATE) && && scope == 0) > return method_missing(recv, mid, argc, argv, CSTAT_PRIV); > > /* self must be kind of a specified form for protected method */ > - if (noex & NOEX_PROTECTED) { > + if ((noex & NOEX_PROTECTED) && scope < 3) { > VALUE defined_class = klass; i personally think instance_eval should be able to call both protected and private methods... it's just too hard to decide once and for all what should be private in an api - this gives uses a way out. take now for instance though - it seems i'm stuck since i cannot call the methods i need without altering the source of rails... ;-( -a -- =============================================================================== | ara [dot] t [dot] howard [at] noaa [dot] gov | all happiness comes from the desire for others to be happy. all misery | comes from the desire for oneself to be happy. | -- bodhicaryavatara ===============================================================================