<commit_before>class CollectorsController < ApplicationController
  before_filter :find_collector_class_for_source, :only => [:new, :create]
  
  def index
    @collectors = ::Collector.all
  end

  def new
    @collector = @collector_class.new
  end
  
  def create
    @collector = @collector_class.new(params[:collector])
    if @collector.save
      redirect_to collectors_path, :notice => 'Collector was successfully created.'
    else
      render :action => "new"      
    end
  end

  def run
    collector = ::Collector.find(params[:id])
    collector.run # TODO Run via delayed_job (or similar solution)
    redirect_to collectors_path
  end
  
  private
<commit_msg>Display collectors in alphabetical order<commit_after>class CollectorsController < ApplicationController
  before_filter :find_collector_class_for_source, :only => [:new, :create]
  
  def index
    @collectors = ::Collector.asc(:source)
  end

  def new
    @collector = @collector_class.new
  end
  
  def create
    @collector = @collector_class.new(params[:collector])
    if @collector.save
      redirect_to collectors_path, :notice => 'Collector was successfully created.'
    else
      render :action => "new"      
    end
  end

  def run
    collector = ::Collector.find(params[:id])
    collector.run # TODO Run via delayed_job (or similar solution)
    redirect_to collectors_path
  end
  
  private

{'fraction_non_alphanumeric': 0.08692528735632184, 'fraction_numerical': 0.0, 'mean_word_length': 3.450479233226837, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3940232', 'n_tokens_mistral': 433, 'n_tokens_neox': 422, 'n_words': 110}