class MetricFu::HotspotRankedProblemLocation

Attributes

granularity[R]
sub_table[R]

Public Class Methods

new(sub_table, granularity) click to toggle source
# File lib/metric_fu/metrics/hotspots/analysis/ranked_problem_location.rb, line 7
def initialize(sub_table, granularity)
  @sub_table = sub_table
  @granularity = granularity
end

Public Instance Methods

assert_sub_table_has_data() click to toggle source
# File lib/metric_fu/metrics/hotspots/analysis/ranked_problem_location.rb, line 64
def assert_sub_table_has_data
  if (sub_table.length == 0)
    raise MetricFu::AnalysisError, "The #{item} '#{value}' does not have any rows in the analysis table"
  end
end
class_location() click to toggle source
# File lib/metric_fu/metrics/hotspots/analysis/ranked_problem_location.rb, line 55
def class_location
  MetricFu::Location.get(file_path, class_name, nil)
end
class_name() click to toggle source
# File lib/metric_fu/metrics/hotspots/analysis/ranked_problem_location.rb, line 39
def class_name
  first_row.class_name
end
file_location() click to toggle source
# File lib/metric_fu/metrics/hotspots/analysis/ranked_problem_location.rb, line 47
def file_location
  MetricFu::Location.get(file_path, nil, nil)
end
file_path() click to toggle source
# File lib/metric_fu/metrics/hotspots/analysis/ranked_problem_location.rb, line 35
def file_path
  first_row.file_path
end
first_row() click to toggle source
# File lib/metric_fu/metrics/hotspots/analysis/ranked_problem_location.rb, line 59
def first_row
  assert_sub_table_has_data
  @first_row ||= sub_table[0]
end
location() click to toggle source
# File lib/metric_fu/metrics/hotspots/analysis/ranked_problem_location.rb, line 26
def location
  @location ||= case granularity
                when :class  then class_location
                when :method then method_location
                when :file   then file_location
                else              raise ArgumentError, "Item must be :class, :method, or :file"
                end
end
method_location() click to toggle source
# File lib/metric_fu/metrics/hotspots/analysis/ranked_problem_location.rb, line 51
def method_location
  MetricFu::Location.get(file_path, class_name, method_name)
end
method_name() click to toggle source
# File lib/metric_fu/metrics/hotspots/analysis/ranked_problem_location.rb, line 43
def method_name
  first_row.method_name
end
problems() click to toggle source

@todo redo as item,value, options = {} Note that the other option for 'details' is :detailed (this isn't at all clear from this method itself

# File lib/metric_fu/metrics/hotspots/analysis/ranked_problem_location.rb, line 22
def problems
  @problems ||= MetricFu::HotspotProblems.new(sub_table).problems
end
to_hash() click to toggle source
# File lib/metric_fu/metrics/hotspots/analysis/ranked_problem_location.rb, line 12
def to_hash
  {
    "location" => location.to_hash,
    "details" =>  MetricFu::Utility.stringify_keys(problems),
  }
end