Class: MetricFu::Grouping
- Inherits:
-
Object
- Object
- MetricFu::Grouping
- Defined in:
- lib/metric_fu/metrics/hotspots/analysis/grouping.rb
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(table, opts) ⇒ Grouping
constructor
A new instance of Grouping.
Constructor Details
#initialize(table, opts) ⇒ Grouping
Returns a new instance of Grouping.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/metric_fu/metrics/hotspots/analysis/grouping.rb', line 6 def initialize(table, opts) column_name = opts.fetch(:by) hash = {} if column_name.to_sym == :metric # special optimized case hash = table.group_by_metric else raise "Unexpected column_name #{column_name}" end @arr = hash.to_a end |
Instance Method Details
#each ⇒ Object
17 18 19 20 21 |
# File 'lib/metric_fu/metrics/hotspots/analysis/grouping.rb', line 17 def each @arr.each do |value, rows| yield value, rows end end |