Class: TestProf::FactoryProf::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/test_prof/factory_prof.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stacks, raw_stats) ⇒ Result

Returns a new instance of Result.



32
33
34
35
# File 'lib/test_prof/factory_prof.rb', line 32

def initialize(stacks, raw_stats)
  @stacks = stacks
  @raw_stats = raw_stats
end

Instance Attribute Details

#raw_statsObject (readonly)

Returns the value of attribute raw_stats.



30
31
32
# File 'lib/test_prof/factory_prof.rb', line 30

def raw_stats
  @raw_stats
end

#stacksObject (readonly)

Returns the value of attribute stacks.



30
31
32
# File 'lib/test_prof/factory_prof.rb', line 30

def stacks
  @stacks
end

Instance Method Details

#statsObject

Returns sorted stats



38
39
40
41
# File 'lib/test_prof/factory_prof.rb', line 38

def stats
  @stats ||= @raw_stats.values
    .sort_by { |el| -el[:total_count] }
end

#total_countObject



43
44
45
# File 'lib/test_prof/factory_prof.rb', line 43

def total_count
  @total_count ||= @raw_stats.values.sum { |v| v[:total_count] }
end

#total_timeObject



47
48
49
# File 'lib/test_prof/factory_prof.rb', line 47

def total_time
  @total_time ||= @raw_stats.values.sum { |v| v[:total_time] }
end