From: Joel VanderWerf Date: 2005-12-06T16:25:34+09:00 Subject: Re: getting around access control Ara.T.Howard wrote: > > i know there is a way to do this - but how > > class C > protected > def meth > 42 > end > end > > c = C::new > > c.instance_eval{ p meth } > > this throws an error, of course, but i'm too tired to remember how to work > around it. > > -a These are probably not helpful: irb(main):012:0> c.instance_eval{ p send(:meth) } 42 => nil irb(main):013:0> c.instance_eval " p meth " 42 => nil The strange thing is that s/protected/private/ avoids the error: irb(main):014:0> class C irb(main):015:1> private irb(main):016:1> def m2; 43; end irb(main):017:1> end => nil irb(main):018:0> c.instance_eval{ p m2 } 43 (ruby-1.8.2, anyway) The original error (in the protected case) seem uncalled for.... -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407