From: Robert Feldt Date: 2006-03-31T16:57:35+09:00 Subject: Redef undef'ed methods? How "final" is a call to undef_method? Is there any way to get the method back, ie. hook it up to the class again? From my understanding of the C code it seems impossible since the function/method pointer is set to 0 and there is no way from Ruby to access the original value for that pointer again (unless you have extracted "it" earlier with one of the "*method" methods). Is this analysis correct? If so code like module Kernel [:eval, :system, :exec, :callcc, :`, # ` :set_trace_func, :sleep, :syscall].each do |m| undef_method m end end class Module [:module_eval, :class_eval, :define_method, :method, :instance_method, :private_class_method].each do |m| undef_method m end end class Object [:instance_eval].each {|m| undef_method m} end etc would give a possibility for a kind of simple, fine-grained "sandboxing"? (I'm not implying you should do this instead of tainting/SAFE-levels etc, just exploring possibilities) Thanks, Robert Feldt