fork download
  1. #!/usr/bin/ruby -w
  2.  
  3. class A
  4. end
  5.  
  6. $a = A.new
  7. $b = 999
  8. $c = A.new
  9.  
  10. p $a, $b, $c
  11.  
  12. puts '---------------------------------'
  13.  
  14. global_variables.each do |var|
  15. if eval "#{var}.instance_of? A"
  16. eval "#{var} = nil"
  17. end
  18. end
  19.  
  20. p $a, $b, $c
Success #stdin #stdout 0s 4892KB
stdin
Standard input is empty
stdout
#<A:0x88fb940>
999
#<A:0x88fb92c>
---------------------------------
nil
999
nil