Class: Minitest::BacktraceFilter (Ruby 2.7.5)
Description: Class : Minitest::BacktraceFilter - Ruby 2.7.5

### Home Classes Methods

### In Files

- minitest-5.13.0/lib/minitest.rb

### Parent

Object

### Methods

- #filter

### Files

- History.rdoc
- README.rdoc

### Class/Module Index

Quicksearch

- Kernel
- Minitest::AbstractReporter
- Minitest::Assertion
- Minitest::Assertions
- Minitest::BacktraceFilter
- Minitest::BenchSpec
- Minitest::Benchmark
- Minitest::CompositeReporter
- Minitest::Expectations
- Minitest::Guard
- Minitest::Mock
- Minitest::Parallel
- Minitest::Parallel::Executor
- Minitest::PrideIO
- Minitest::PrideLOL
- Minitest::ProgressReporter
- Minitest::Reportable
- Minitest::Result
- Minitest::Skip
- Minitest::Spec
- Minitest::Spec::DSL
- Minitest::Spec::DSL::InstanceMethods
- Minitest::StatisticsReporter
- Minitest::SummaryReporter
- Minitest::Test
- Minitest::Test::LifecycleHooks
- Minitest::UnexpectedError
- Object
- SubThingySpec
- ThingySpec

No matching classes.

# Minitest::BacktraceFilter

The standard backtrace filter for minitest.

See Minitest.backtrace_filter=.

### Public Instance Methods

filter(bt) click to toggle source

Filter `bt` to something useful. Returns the whole thing if $DEBUG.

                   # File minitest-5.13.0/lib/minitest.rb, line 1013
    def filter bt
      return ["No backtrace"] unless bt

      return bt.dup if $DEBUG

      new_bt = bt.take_while { |line| line !~ MT_RE }
      new_bt = bt.select     { |line| line !~ MT_RE } if new_bt.empty?
      new_bt = bt.dup                                 if new_bt.empty?

      new_bt
    end