class Attractor::BaseReporter
base reporter
Attributes
file_prefix[RW]
types[R]
values[W]
Public Class Methods
new(calculators:, file_prefix: "", ignores: "", open_browser: true)
click to toggle source
# File lib/attractor/reporters/base_reporter.rb, line 18 def initialize(calculators:, file_prefix: "", ignores: "", open_browser: true) @file_prefix = file_prefix || "" @calculators = calculators @open_browser = open_browser @suggester = Suggester.new(values) @watcher = Watcher.new(@file_prefix, ignores, lambda do report end) rescue NoMethodError => _e raise "There was a problem gathering churn changes" end
Public Instance Methods
render()
click to toggle source
# File lib/attractor/reporters/base_reporter.rb, line 42 def render "Attractor" end
report()
click to toggle source
# File lib/attractor/reporters/base_reporter.rb, line 37 def report @suggestions = @suggester.suggest @types = Hash[@calculators.map { |calc| [calc.first, calc.last.type] }] end
suggestions(quantile:, type: "rb")
click to toggle source
# File lib/attractor/reporters/base_reporter.rb, line 31 def suggestions(quantile:, type: "rb") @suggester.values = values(type: type) @suggestions = @suggester.suggest(quantile) @suggestions end
values(type: "rb")
click to toggle source
# File lib/attractor/reporters/base_reporter.rb, line 46 def values(type: "rb") @values = @calculators[type].calculate @values rescue NoMethodError => _e puts "No calculator for type #{type}" end