Module: ActiveSupport::Dependencies::Blamable

Defined in:
activesupport/lib/active_support/dependencies.rb

Overview

Exception file-blaming

Instance Method Summary collapse

Instance Method Details

#blame_file!(file) ⇒ Object



264
265
266
# File 'activesupport/lib/active_support/dependencies.rb', line 264

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

#blamed_filesObject



268
269
270
# File 'activesupport/lib/active_support/dependencies.rb', line 268

def blamed_files
  @blamed_files ||= []
end

#copy_blame!(exc) ⇒ Object



277
278
279
280
# File 'activesupport/lib/active_support/dependencies.rb', line 277

def copy_blame!(exc)
  @blamed_files = exc.blamed_files.clone
  self
end

#describe_blameObject



272
273
274
275
# File 'activesupport/lib/active_support/dependencies.rb', line 272

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