From: David Alan Black Date: 2001-10-24T09:26:47+09:00 Subject: [ruby-talk:23126] enough about Python -- here's something fun in Ruby :-) Hello -- This emerged from some tinkering, and I actually thought it was kind of cool: class Module def privately(&block) instance_eval "private; block.call; public" end end class Thing privately do def hidden puts "hi" end end def visible hidden end end Thing.new.visible # => hi Thing.new.hidden # => error: hidden method called I'm not sure why I used instance_eval, rather than some other flavor of eval. They all seem to work... though presumably there's something hidden going on that makes only one (or perhaps none :-) appropriate. David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav