Sha256: 47cbd78e48c71587dab1b08f2701c9761ee44d8e4703665cbdd32c91db69a374
Contents?: true
Size: 1.2 KB
Versions: 1
Compression:
Stored size: 1.2 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 render json: @reporter.suggestions(threshold).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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
attractor-rails-0.1.0 | app/controllers/attractor/rails/reporter_controller.rb |