On Dec 6, 2006, at 18:11 , Harold Hausman wrote: > On 12/7/06, John Carter <john.carter / tait.co.nz> wrote: >> On Thu, 7 Dec 2006, Edwin Fine wrote: >> >> > Jeremy Henty wrote: >> >> On 2006-12-05, Edwin Fine <efine145-nospam01 / usa.net> wrote: >> >> >> >>> How about a Ruby Quiz for the funniest way to shoot yourself >> in the >> >>> foot with Ruby? >> >> #!/bin/ruby -w >> >> me = File.read( __FILE__) >> open( __FILE__, 'w') do |f| >> f.syswrite( me.sub( /ruby -w/, 'sh')) >> end >> >> Although this works fairly well too... >> >> #!/bin/ruby -w >> >> me = File.read( __FILE__) >> open( __FILE__, 'w') do |f| >> f.syswrite( me.sub( /-w/, 'sh')) >> end >> > > Thats cute. > > How about this? > Object.constants.each do |x| eval( "#{x} = nil" ) end > > Seems to shoot irb in the foot, for various values of foot, like head. eval? please! Object.constants.each do |c| Object.send :remove_const, c end -- Eric Hodel - drbrain / segment7.net - http://blog.segment7.net I LIT YOUR GEM ON FIRE!