Class: TestProf::FactoryProf::Result
- Inherits:
-
Object
- Object
- TestProf::FactoryProf::Result
- Defined in:
- lib/test_prof/factory_prof.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#raw_stats ⇒ Object
readonly
Returns the value of attribute raw_stats.
-
#stacks ⇒ Object
readonly
Returns the value of attribute stacks.
Instance Method Summary collapse
-
#initialize(stacks, raw_stats) ⇒ Result
constructor
A new instance of Result.
-
#stats ⇒ Object
Returns sorted stats.
- #total_count ⇒ Object
- #total_time ⇒ Object
Constructor Details
#initialize(stacks, raw_stats) ⇒ Result
Returns a new instance of Result.
52 53 54 55 |
# File 'lib/test_prof/factory_prof.rb', line 52 def initialize(stacks, raw_stats) @stacks = stacks @raw_stats = raw_stats end |
Instance Attribute Details
#raw_stats ⇒ Object (readonly)
Returns the value of attribute raw_stats.
50 51 52 |
# File 'lib/test_prof/factory_prof.rb', line 50 def raw_stats @raw_stats end |
#stacks ⇒ Object (readonly)
Returns the value of attribute stacks.
50 51 52 |
# File 'lib/test_prof/factory_prof.rb', line 50 def stacks @stacks end |
Instance Method Details
#stats ⇒ Object
Returns sorted stats
58 59 60 61 62 63 64 65 66 67 |
# File 'lib/test_prof/factory_prof.rb', line 58 def stats @stats ||= @raw_stats.values.sort_by { |el| -el[:total_count] }.map do |stat| unless stat[:variations].empty? stat = stat.dup stat[:variations] = stat[:variations].values.sort_by { |nested_el| -nested_el[:total_count] } end stat end end |
#total_count ⇒ Object
69 70 71 |
# File 'lib/test_prof/factory_prof.rb', line 69 def total_count @total_count ||= @raw_stats.values.sum { |v| v[:total_count] } end |
#total_time ⇒ Object
73 74 75 |
# File 'lib/test_prof/factory_prof.rb', line 73 def total_time @total_time ||= @raw_stats.values.sum { |v| v[:total_time] } end |