Class: MetricFu::Ranking
- Inherits:
-
Object
- Object
- MetricFu::Ranking
- Extended by:
- Forwardable
- Defined in:
- lib/metric_fu/metrics/hotspots/analysis/ranking.rb
Instance Method Summary collapse
-
#initialize ⇒ Ranking
constructor
A new instance of Ranking.
- #percentile(item) ⇒ Object
- #top ⇒ Object
Constructor Details
#initialize ⇒ Ranking
Returns a new instance of Ranking.
6 7 8 |
# File 'lib/metric_fu/metrics/hotspots/analysis/ranking.rb', line 6 def initialize @items_to_score = {} end |
Instance Method Details
#percentile(item) ⇒ Object
14 15 16 17 18 |
# File 'lib/metric_fu/metrics/hotspots/analysis/ranking.rb', line 14 def percentile(item) index = sorted_items.index(item) worse_item_count = (length - (index + 1)) worse_item_count.to_f / length end |
#top ⇒ Object
10 11 12 |
# File 'lib/metric_fu/metrics/hotspots/analysis/ranking.rb', line 10 def top sorted_items end |