Class: RSpec::Core::Formatters::ExceptionPresenter::Factory::CommonBacktraceTruncater Private
Do not use. This class is for internal use only.
Relationships & Source Files | |
Inherits: | Object |
Defined in: | rspec-core/lib/rspec/core/formatters/exception_presenter.rb |
Class Method Summary
- .new(parent) ⇒ CommonBacktraceTruncater constructor Internal use only
Instance Method Summary
- #with_truncated_backtrace(child) Internal use only
Instance Method Details
#with_truncated_backtrace(child)
[ GitHub ]# File 'rspec-core/lib/rspec/core/formatters/exception_presenter.rb', line 433
def with_truncated_backtrace(child) child_bt = child.backtrace parent_bt = @parent.backtrace return child if child_bt.nil? || child_bt.empty? || parent_bt.nil? index_before_first_common_frame = -1.downto(-child_bt.size).find do |index| parent_bt[index] != child_bt[index] end return child if index_before_first_common_frame.nil? return child if index_before_first_common_frame == -1 child = child.dup child.set_backtrace(child_bt[0..index_before_first_common_frame]) child end