Class: Rails::BacktraceCleaner
Do not use. This class is for internal use only.
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
|
|
Instance Chain:
|
|
Inherits: |
ActiveSupport::BacktraceCleaner
|
Defined in: | railties/lib/rails/backtrace_cleaner.rb |
Constant Summary
-
APP_DIRS_PATTERN =
# File 'railties/lib/rails/backtrace_cleaner.rb', line 8/\A(?:\.\/)?(?:app|config|lib|test|\(\w(?:-\w)*\))/
-
RENDER_TEMPLATE_PATTERN =
# File 'railties/lib/rails/backtrace_cleaner.rb', line 9/:in [`'].*_\w_{2,3}\d_\d+'/
::ActiveSupport::BacktraceCleaner
- Inherited
Class Method Summary
Instance Method Summary
- #clean(backtrace, kind = :silent) (also: #filter)
- #clean_frame(frame, kind = :silent)
-
#filter(backtrace, kind = :silent)
Alias for #clean.
::ActiveSupport::BacktraceCleaner
- Inherited
#add_filter | Adds a filter from the block provided. |
#add_silencer | Adds a silencer from the block provided. |
#clean | Returns the backtrace after all filters and silencers have been run against it. |
#clean_frame | Returns the frame with all filters applied. |
#filter | Alias for ActiveSupport::BacktraceCleaner#clean. |
#remove_filters! | Removes all filters, but leaves in the silencers. |
#remove_silencers! | Removes all silencers, but leaves in the filters. |
#add_core_silencer, #add_gem_filter, #add_gem_silencer, #add_stdlib_silencer, #filter_backtrace, #initialize_copy, #noise, #silence |
Constructor Details
.new ⇒ BacktraceCleaner
# File 'railties/lib/rails/backtrace_cleaner.rb', line 11
def initialize super add_filter do |line| # We may be called before Rails.root is assigned. # When that happens we fallback to not truncating. @root ||= Rails.root && "#{Rails.root}/" @root && line.start_with?(@root) ? line.from(@root.size) : line end add_filter do |line| if RENDER_TEMPLATE_PATTERN.match?(line) line.sub(RENDER_TEMPLATE_PATTERN, "") else line end end add_silencer { |line| !APP_DIRS_PATTERN.match?(line) } end
Instance Method Details
#clean(backtrace, kind = :silent) Also known as: #filter
[ GitHub ]# File 'railties/lib/rails/backtrace_cleaner.rb', line 29
def clean(backtrace, kind = :silent) return backtrace if ENV["BACKTRACE"] super(backtrace, kind) end
#clean_frame(frame, kind = :silent)
[ GitHub ]# File 'railties/lib/rails/backtrace_cleaner.rb', line 36
def clean_frame(frame, kind = :silent) return frame if ENV["BACKTRACE"] super(frame, kind) end
#filter(backtrace, kind = :silent)
Alias for #clean.
# File 'railties/lib/rails/backtrace_cleaner.rb', line 34
alias_method :filter, :clean