Class: Evilution::Integration::RSpec::StateGuard::ReporterArrays Private

Inherits:
Object
  • Object
show all
Defined in:
lib/evilution/integration/rspec/state_guard/reporter_arrays.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Constant Summary collapse

IVARS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

%i[@examples @failed_examples @pending_examples].freeze

Instance Method Summary collapse

Instance Method Details

#release(lengths) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/evilution/integration/rspec/state_guard/reporter_arrays.rb', line 21

def release(lengths)
  return unless lengths

  reporter = Evilution::Integration::RSpec::StateGuard::Internals.config_ivar(:@reporter)
  return unless reporter

  lengths.each do |ivar, length|
    arr = reporter.instance_variable_get(ivar)
    arr.slice!(length..) if arr.is_a?(Array) && arr.length > length
  end
end

#snapshotObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/evilution/integration/rspec/state_guard/reporter_arrays.rb', line 9

def snapshot
  reporter = Evilution::Integration::RSpec::StateGuard::Internals.config_ivar(:@reporter)
  return nil unless reporter

  IVARS.each_with_object({}) do |ivar, acc|
    next unless reporter.instance_variable_defined?(ivar)

    arr = reporter.instance_variable_get(ivar)
    acc[ivar] = arr.length if arr.is_a?(Array)
  end
end