Class: MetricFu::Hotspots
Instance Attribute Summary
Attributes inherited from Generator
#report, #template
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Generator
class_name, #create_data_dir_if_missing, #create_metric_dir_if_missing, #create_output_dir_if_missing, generate_report, #generate_report, metric_directory, #metric_directory, #remove_excluded_files, #round_to_tenths, #to_graph
Constructor Details
#initialize(options = {}) ⇒ Hotspots
Returns a new instance of Hotspots.
5
6
7
|
# File 'lib/generators/hotspots.rb', line 5
def initialize(options={})
super
end
|
Class Method Details
.verify_dependencies! ⇒ Object
9
10
11
|
# File 'lib/generators/hotspots.rb', line 9
def self.verify_dependencies!
true
end
|
Instance Method Details
#analyze ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/generators/hotspots.rb', line 17
def analyze
num = nil
worst_items = {}
if @analyzer
worst_items[:files] =
@analyzer.worst_files(num).inject([]) do |array, worst_file|
array <<
{:location => @analyzer.location(:file, worst_file),
:details => @analyzer.problems_with(:file, worst_file)}
array
end
worst_items[:classes] = @analyzer.worst_classes(num).inject([]) do |array, class_name|
location = @analyzer.location(:class, class_name)
array <<
{:location => location,
:details => @analyzer.problems_with(:class, class_name)}
array
end
worst_items[:methods] = @analyzer.worst_methods(num).inject([]) do |array, method_name|
location = @analyzer.location(:method, method_name)
array <<
{:location => location,
:details => @analyzer.problems_with(:method, method_name)}
array
end
end
@hotspots = worst_items
end
|
#to_h ⇒ Object
47
48
49
|
# File 'lib/generators/hotspots.rb', line 47
def to_h
{:hotspots => @hotspots}
end
|