Method: Zeus::LoadTracking.track_features_loaded_by
- Defined in:
- lib/zeus/load_tracking.rb
.track_features_loaded_by ⇒ Object
Internal: This should only be called by Zeus code
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/zeus/load_tracking.rb', line 11 def track_features_loaded_by old_features = $LOADED_FEATURES.dup # Catch exceptions so we can determine the features # that were being loaded at the time of the exception. err_features = [] begin yield rescue SyntaxError => err # SyntaxErrors are a bit weird in that the file containing # the error is not in the backtrace, only the error message. match = /\A([^:]+):\d+: syntax error/.match(err.) err_features << match[1] if match raise rescue ScriptError => err raise rescue => err raise ensure if err && err.backtrace err_features += err.backtrace.map { |b| b.split(':').first } .select { |f| f.start_with?('/') } .take_while { |f| f != __FILE__ } end notify_features(Set.new($LOADED_FEATURES) + err_features - old_features) end end |