class MetricFu::Hotspots

Public Class Methods

new(options={}) click to toggle source
Calls superclass method MetricFu::Generator::new
# File lib/generators/hotspots.rb, line 5
def initialize(options={})
  super
end
verify_dependencies!() click to toggle source
# File lib/generators/hotspots.rb, line 9
def self.verify_dependencies!
  true
end

Public Instance Methods

analyze() click to toggle source
# 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
emit() click to toggle source
# File lib/generators/hotspots.rb, line 13
def emit
  @analyzer = MetricAnalyzer.new(MetricFu.report.report_hash)
end
to_h() click to toggle source
# File lib/generators/hotspots.rb, line 47
def to_h
  {:hotspots => @hotspots}
end