Class: XCKnife::EventsAnalyzer

Inherits:
Object
  • Object
show all
Includes:
JsonStreamParserHelper
Defined in:
lib/xcknife/events_analyzer.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from JsonStreamParserHelper

#each_test_event, #normalize_result

Constructor Details

#initialize(events, relevant_partitions) ⇒ EventsAnalyzer

Returns a new instance of EventsAnalyzer.


17
18
19
20
21
# File 'lib/xcknife/events_analyzer.rb', line 17

def initialize(events, relevant_partitions)
  @total_tests = 0
  @relevant_partitions = relevant_partitions
  @target_class_map = analyze_events(events)
end

Instance Attribute Details

#target_class_mapObject (readonly)

Returns the value of attribute target_class_map


9
10
11
# File 'lib/xcknife/events_analyzer.rb', line 9

def target_class_map
  @target_class_map
end

#total_testsObject (readonly)

Returns the value of attribute total_tests


9
10
11
# File 'lib/xcknife/events_analyzer.rb', line 9

def total_tests
  @total_tests
end

Class Method Details

.for(events, relevant_partitions) ⇒ Object


11
12
13
14
15
# File 'lib/xcknife/events_analyzer.rb', line 11

def self.for(events, relevant_partitions)
  return NullEventsAnalyzer.new if events.nil?

  new(events, relevant_partitions)
end

Instance Method Details

#test_class?(target, clazz) ⇒ Boolean

Returns:

  • (Boolean)

27
28
29
# File 'lib/xcknife/events_analyzer.rb', line 27

def test_class?(target, clazz)
  test_target?(target) and target_class_map[target].include?(clazz)
end

#test_target?(target) ⇒ Boolean

Returns:

  • (Boolean)

23
24
25
# File 'lib/xcknife/events_analyzer.rb', line 23

def test_target?(target)
  target_class_map.key?(target)
end