class MetricFu::HotspotAnalyzedProblems

Public Class Methods

new(hotspot_rankings, analyzer_tables) click to toggle source
# File lib/metric_fu/metrics/hotspots/analysis/analyzed_problems.rb, line 5
def initialize(hotspot_rankings, analyzer_tables)
  @hotspot_rankings = hotspot_rankings
  @analyzer_tables = analyzer_tables
end

Public Instance Methods

worst_items() click to toggle source
# File lib/metric_fu/metrics/hotspots/analysis/analyzed_problems.rb, line 10
def worst_items
  worst_items = {}
  worst_items[:files]   = worst(@hotspot_rankings.worst_files,   :file)
  worst_items[:classes] = worst(@hotspot_rankings.worst_classes, :class)
  worst_items[:methods] = worst(@hotspot_rankings.worst_methods, :method)
  worst_items
end

Private Instance Methods

get_sub_table(granularity, ranked_item_name) click to toggle source
# File lib/metric_fu/metrics/hotspots/analysis/analyzed_problems.rb, line 29
def get_sub_table(granularity, ranked_item_name)
  tables = @analyzer_tables.tables_for(granularity)
  tables[ranked_item_name]
end
worst(rankings, granularity) click to toggle source

@param rankings [Array<MetricFu::HotspotRankings>] @param granularity [Symbol] one of :class, :method, :file

# File lib/metric_fu/metrics/hotspots/analysis/analyzed_problems.rb, line 22
def worst(rankings, granularity)
  rankings.map do |ranked_item_name|
    sub_table = get_sub_table(granularity, ranked_item_name)
    MetricFu::HotspotRankedProblemLocation.new(sub_table, granularity)
  end
end