Class: SixthSense::AnalysisContext

Inherits:
Object
  • Object
show all
Defined in:
lib/sixth_sense/analysis_context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config: {}, coverage_maps: {}, checked_coverage_maps: {}, kill_matrices: {}, warnings: []) ⇒ AnalysisContext

Returns a new instance of AnalysisContext.



7
8
9
10
11
12
13
# File 'lib/sixth_sense/analysis_context.rb', line 7

def initialize(config: {}, coverage_maps: {}, checked_coverage_maps: {}, kill_matrices: {}, warnings: [])
  @config = config
  @coverage_maps = coverage_maps
  @checked_coverage_maps = checked_coverage_maps
  @kill_matrices = kill_matrices
  @warnings = warnings
end

Instance Attribute Details

#checked_coverage_mapsObject (readonly)

Returns the value of attribute checked_coverage_maps.



5
6
7
# File 'lib/sixth_sense/analysis_context.rb', line 5

def checked_coverage_maps
  @checked_coverage_maps
end

#configObject (readonly)

Returns the value of attribute config.



5
6
7
# File 'lib/sixth_sense/analysis_context.rb', line 5

def config
  @config
end

#coverage_mapsObject (readonly)

Returns the value of attribute coverage_maps.



5
6
7
# File 'lib/sixth_sense/analysis_context.rb', line 5

def coverage_maps
  @coverage_maps
end

#kill_matricesObject (readonly)

Returns the value of attribute kill_matrices.



5
6
7
# File 'lib/sixth_sense/analysis_context.rb', line 5

def kill_matrices
  @kill_matrices
end

#warningsObject (readonly)

Returns the value of attribute warnings.



5
6
7
# File 'lib/sixth_sense/analysis_context.rb', line 5

def warnings
  @warnings
end

Instance Method Details

#checked_coverage_map_for(test_file) ⇒ Object



19
20
21
# File 'lib/sixth_sense/analysis_context.rb', line 19

def checked_coverage_map_for(test_file)
  checked_coverage_maps[test_file.path]
end

#config_fetch(*keys, default: nil) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/sixth_sense/analysis_context.rb', line 27

def config_fetch(*keys, default: nil)
  keys.reduce(config) do |current, key|
    break default unless current.respond_to?(:fetch)

    current.fetch(key.to_s) { current.fetch(key.to_sym, default) }
  end
end

#coverage_map_for(test_file) ⇒ Object



15
16
17
# File 'lib/sixth_sense/analysis_context.rb', line 15

def coverage_map_for(test_file)
  coverage_maps[test_file.path]
end

#kill_matrix_for(test_file) ⇒ Object



23
24
25
# File 'lib/sixth_sense/analysis_context.rb', line 23

def kill_matrix_for(test_file)
  kill_matrices[test_file.path]
end