Class: Watchr::FlogMetric::ClassReportFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/watchr/metrics/flog/class_report_factory.rb

Class Method Summary collapse

Class Method Details

.build(klass, total, methods, method_locations) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/watchr/metrics/flog/class_report_factory.rb', line 8

def self.build(klass, total, methods, method_locations)
  clazz = FlogReportClass.new(klass, total)

  methods.each do |name, score|
    next if name =~ /#none/

    method_location = method_locations[name]
    location = method_location ? Location.from_path(method_location) : nil

    clazz.add_method(FlogReportMethod.new(clazz, name, score, location))
  end

  clazz
end