Class: RSpec::Signal::Backtrace::Reduced

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/signal/backtrace/reducer.rb

Overview

The result of reducing one backtrace.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entries:, total:, omitted:, fallback: false) ⇒ Reduced

Returns a new instance of Reduced.



29
30
31
32
33
34
# File 'lib/rspec/signal/backtrace/reducer.rb', line 29

def initialize(entries:, total:, omitted:, fallback: false)
  @entries  = entries
  @total    = total
  @omitted  = omitted
  @fallback = fallback
end

Instance Attribute Details

#entriesObject (readonly)

Returns the value of attribute entries.



27
28
29
# File 'lib/rspec/signal/backtrace/reducer.rb', line 27

def entries
  @entries
end

#fallbackObject (readonly)

Returns the value of attribute fallback.



27
28
29
# File 'lib/rspec/signal/backtrace/reducer.rb', line 27

def fallback
  @fallback
end

#omittedObject (readonly)

Returns the value of attribute omitted.



27
28
29
# File 'lib/rspec/signal/backtrace/reducer.rb', line 27

def omitted
  @omitted
end

#totalObject (readonly)

Returns the value of attribute total.



27
28
29
# File 'lib/rspec/signal/backtrace/reducer.rb', line 27

def total
  @total
end

Instance Method Details

#culpritObject

The frame that best identifies where this blew up: the innermost frame that is not test-runner plumbing.



46
# File 'lib/rspec/signal/backtrace/reducer.rb', line 46

def culprit = frames.first

#empty?Boolean

Returns:

  • (Boolean)


40
# File 'lib/rspec/signal/backtrace/reducer.rb', line 40

def empty?         = frames.empty?

#fallback?Boolean

Returns:

  • (Boolean)


39
# File 'lib/rspec/signal/backtrace/reducer.rb', line 39

def fallback?      = @fallback

#framesObject



36
# File 'lib/rspec/signal/backtrace/reducer.rb', line 36

def frames         = entries.select(&:frame?)

#kept_countObject



38
# File 'lib/rspec/signal/backtrace/reducer.rb', line 38

def kept_count     = frames.size

#omitted_countObject



42
# File 'lib/rspec/signal/backtrace/reducer.rb', line 42

def omitted_count = omitted.values.sum

#primary_locationObject

The innermost first-party frame — what the agent should open first.



49
# File 'lib/rspec/signal/backtrace/reducer.rb', line 49

def primary_location = project_frames.first

#project_framesObject



37
# File 'lib/rspec/signal/backtrace/reducer.rb', line 37

def project_frames = frames.select(&:project?)

#to_aObject



51
# File 'lib/rspec/signal/backtrace/reducer.rb', line 51

def to_a = entries.map(&:to_s)