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.



14
15
16
17
18
# File 'lib/xcknife/events_analyzer.rb', line 14

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.



7
8
9
# File 'lib/xcknife/events_analyzer.rb', line 7

def target_class_map
  @target_class_map
end

#total_testsObject (readonly)

Returns the value of attribute total_tests.



7
8
9
# File 'lib/xcknife/events_analyzer.rb', line 7

def total_tests
  @total_tests
end

Class Method Details

.for(events, relevant_partitions) ⇒ Object



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

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

Instance Method Details

#has_test_class?(target, clazz) ⇒ Boolean

Returns:

  • (Boolean)


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

def has_test_class?(target, clazz)
  has_test_target?(target) and target_class_map[target].include?(clazz)
end

#has_test_target?(target) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/xcknife/events_analyzer.rb', line 20

def has_test_target?(target)
  target_class_map.has_key?(target)
end