Exception: Exception

Defined in:
lib/active_support/dependencies.rb

Overview

Add file-blaming to exceptions

Instance Method Summary collapse

Instance Method Details

#blame_file!(file) ⇒ Object


200
201
202
# File 'lib/active_support/dependencies.rb', line 200

def blame_file!(file)
  (@blamed_files ||= []).unshift file
end

#blamed_filesObject


204
205
206
# File 'lib/active_support/dependencies.rb', line 204

def blamed_files
  @blamed_files ||= []
end

#describe_blameObject


208
209
210
211
# File 'lib/active_support/dependencies.rb', line 208

def describe_blame
  return nil if blamed_files.empty?
  "This error occured while loading the following files:\n   #{blamed_files.join "\n   "}"
end