Quakespotter.app/lib/ruby-processing/runners/watch.rb
# Try to go back to the recorded Ruby state.
Try to go back to the recorded Ruby state.
Try to go back to the recorded Ruby state .
def rewind_to_recorded_state
      new_constants  = Object.send(:constants).reject {|c| @saved_constants.include?(c) }
      new_load_paths = $LOAD_PATH.reject {|p| @saved_load_paths.include?(p) }
      new_features   = $LOADED_FEATURES.reject {|f| @saved_features.include?(f) }
      new_globals    = Kernel.global_variables.reject {|g| @saved_globals.include?(g) }
      Processing::App.recursively_remove_constants(Object, new_constants)
      new_load_paths.each {|p| $LOAD_PATH.delete(p) }
      new_features.each {|f| $LOADED_FEATURES.delete(f) }
      new_globals.each do |g| 
        begin
          eval("#{g} = nil") 
        rescue NameError => e
        end
      end
    end
def rewind_to_recorded_state new_constants = Object . send ( :constants ) . reject { | c | @saved_constants . include? ( c ) } new_load_paths = $LOAD_PATH . reject { | p | @saved_load_paths . include? ( p ) } new_features = $LOADED_FEATURES . reject { | f | @saved_features . include? ( f ) } new_globals = Kernel . global_variables . reject { | g | @saved_globals . include? ( g ) } Processing :: App . recursively_remove_constants ( Object , new_constants ) new_load_paths . each { | p | $LOAD_PATH . delete ( p ) } new_features . each { | f | $LOADED_FEATURES . delete ( f ) } new_globals . each do | g | begin eval ( "#{g} = nil" ) rescue NameError => e end end end
Try to go back to the recorded Ruby state.
Try to go back to the recorded Ruby state .
# There's no way to undef a global variable in Ruby # Some globals are read-only, and we can't set them to nil.