Sha256: 0e1140775ec7b0da6e98003e1ed20db265f0887c86d0e6d0302da62250c6c40b
Contents?: true
Size: 1.26 KB
Versions: 3
Compression:
Stored size: 1.26 KB
Contents
require_dependency "attractor/rails/application_controller" require "attractor" require "attractor/reporters/rails_reporter" module Attractor::Rails class ReporterController < ApplicationController layout false before_action :load_reporter def index @types = @reporter.types end def file_prefix render json: {file_prefix: @reporter.file_prefix} end def values type = params[:type] || "rb" render json: @reporter.values(type: type).map(&:to_h) end def suggestions threshold = params[:t] || 95 type = params[:type] || "rb" render json: @reporter.suggestions(quantile: threshold, type: type).map(&:to_h) end private def load_reporter calculators = Attractor.calculators_for_type(nil, start_ago: Attractor::Rails.start_ago, minimum_churn_count: Attractor::Rails.minimum_churn_count, file_prefix: Attractor::Rails.file_prefix) @reporter = Attractor::RailsReporter.new(calculators: calculators, file_prefix: Attractor::Rails.file_prefix) @reporter.report end end end
Version data entries
3 entries across 3 versions & 1 rubygems