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 ⇒ Object
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_stats ⇒ Object (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 |
#stacks ⇒ Object (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
#stats ⇒ Object
Returns sorted stats
38 39 40 41 42 43 |
# File 'lib/test_prof/factory_prof.rb', line 38 def stats return @stats if instance_variable_defined?(:@stats) @stats = @raw_stats.values .sort_by { |el| -el[:total] } end |
#total ⇒ Object
45 46 47 48 |
# File 'lib/test_prof/factory_prof.rb', line 45 def total return @total if instance_variable_defined?(:@total) @total = @raw_stats.values.sum { |v| v[:total] } end |