Class: MetricFu::HotspotRankedProblemLocation
- Inherits:
-
Object
- Object
- MetricFu::HotspotRankedProblemLocation
- Defined in:
- lib/metric_fu/metrics/hotspots/analysis/ranked_problem_location.rb
Instance Attribute Summary collapse
-
#granularity ⇒ Object
readonly
Returns the value of attribute granularity.
-
#sub_table ⇒ Object
readonly
Returns the value of attribute sub_table.
Instance Method Summary collapse
- #assert_sub_table_has_data ⇒ Object
- #class_location ⇒ Object
- #class_name ⇒ Object
- #file_location ⇒ Object
- #file_path ⇒ Object
- #first_row ⇒ Object
-
#initialize(sub_table, granularity) ⇒ HotspotRankedProblemLocation
constructor
A new instance of HotspotRankedProblemLocation.
- #location ⇒ Object
- #method_location ⇒ Object
- #method_name ⇒ Object
-
#problems ⇒ Object
Note that the other option for ‘details’ is :detailed (this isn’t at all clear from this method itself.
- #to_hash ⇒ Object
Constructor Details
#initialize(sub_table, granularity) ⇒ HotspotRankedProblemLocation
Returns a new instance of HotspotRankedProblemLocation.
7 8 9 10 |
# 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 |
Instance Attribute Details
#granularity ⇒ Object (readonly)
Returns the value of attribute granularity.
6 7 8 |
# File 'lib/metric_fu/metrics/hotspots/analysis/ranked_problem_location.rb', line 6 def granularity @granularity end |
#sub_table ⇒ Object (readonly)
Returns the value of attribute sub_table.
6 7 8 |
# File 'lib/metric_fu/metrics/hotspots/analysis/ranked_problem_location.rb', line 6 def sub_table @sub_table end |
Instance Method Details
#assert_sub_table_has_data ⇒ Object
64 65 66 67 68 |
# 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 ⇒ Object
55 56 57 |
# 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 ⇒ Object
39 40 41 |
# File 'lib/metric_fu/metrics/hotspots/analysis/ranked_problem_location.rb', line 39 def class_name first_row.class_name end |
#file_location ⇒ Object
47 48 49 |
# 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 ⇒ Object
35 36 37 |
# File 'lib/metric_fu/metrics/hotspots/analysis/ranked_problem_location.rb', line 35 def file_path first_row.file_path end |
#first_row ⇒ Object
59 60 61 62 |
# 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 ⇒ Object
26 27 28 29 30 31 32 33 |
# 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 ⇒ Object
51 52 53 |
# 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 ⇒ Object
43 44 45 |
# File 'lib/metric_fu/metrics/hotspots/analysis/ranked_problem_location.rb', line 43 def method_name first_row.method_name end |
#problems ⇒ Object
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
22 23 24 |
# 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 ⇒ Object
12 13 14 15 16 17 |
# 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 |